Skip to content

Commit 797dc3c

Browse files
Volodymyr OrlovVolodymyr Orlov
authored andcommitted
fix: formatting
1 parent cf4f658 commit 797dc3c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/svm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Kernels {
7979
#[derive(Serialize, Deserialize, Debug)]
8080
pub struct LinearKernel {}
8181

82-
/// Radial basis function (Gaussian) kernel
82+
/// Radial basis function (Gaussian) kernel
8383
pub struct RBFKernel<T: RealNumber> {
8484
/// kernel coefficient
8585
pub gamma: T,

src/svm/svc.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ impl<T: RealNumber, M: Matrix<T>, K: Kernel<T, M::RowVector>> SVC<T, M, K> {
155155

156156
if classes.len() != 2 {
157157
return Err(Failed::fit(&format!(
158-
"Incorrect number of classes {}", classes.len()
158+
"Incorrect number of classes {}",
159+
classes.len()
159160
)));
160161
}
161162

@@ -166,7 +167,7 @@ impl<T: RealNumber, M: Matrix<T>, K: Kernel<T, M::RowVector>> SVC<T, M, K> {
166167
if y_v != -T::one() || y_v != T::one() {
167168
match y_v == classes[0] {
168169
true => y.set(i, -T::one()),
169-
false => y.set(i, T::one())
170+
false => y.set(i, T::one()),
170171
}
171172
}
172173
}
@@ -194,7 +195,7 @@ impl<T: RealNumber, M: Matrix<T>, K: Kernel<T, M::RowVector>> SVC<T, M, K> {
194195
for i in 0..n {
195196
let cls_idx = match self.predict_for_row(x.get_row(i)) == T::one() {
196197
false => self.classes[0],
197-
true => self.classes[1]
198+
true => self.classes[1],
198199
};
199200
y_hat.set(i, cls_idx);
200201
}
@@ -720,7 +721,8 @@ mod tests {
720721
]);
721722

722723
let y: Vec<f64> = vec![
723-
-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
724+
-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
725+
1.,
724726
];
725727

726728
let y_hat = SVC::fit(
@@ -734,7 +736,7 @@ mod tests {
734736
},
735737
)
736738
.and_then(|lr| lr.predict(&x))
737-
.unwrap();
739+
.unwrap();
738740

739741
assert!(accuracy(&y_hat, &y) >= 0.9);
740742
}

0 commit comments

Comments
 (0)