Skip to content

Commit f037167

Browse files
Volodymyr OrlovVolodymyr Orlov
authored andcommitted
fix: changes recommended by Clippy
1 parent 8f72716 commit f037167

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/linear/logistic_regression.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ impl<T: RealNumber, M: Matrix<T>> PartialEq for LogisticRegression<T, M> {
110110
return false;
111111
}
112112
}
113-
114-
return self.coefficients == other.coefficients && self.intercept == other.intercept;
113+
114+
self.coefficients == other.coefficients && self.intercept == other.intercept
115115
}
116116
}
117117
}
@@ -242,7 +242,7 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
242242
let x0 = M::zeros(1, num_attributes + 1);
243243

244244
let objective = BinaryObjectiveFunction {
245-
x: x,
245+
x,
246246
y: yi,
247247
phantom: PhantomData,
248248
};
@@ -254,18 +254,18 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
254254
Ok(LogisticRegression {
255255
coefficients: weights.slice(0..1, 0..num_attributes),
256256
intercept: weights.slice(0..1, num_attributes..num_attributes + 1),
257-
classes: classes,
258-
num_attributes: num_attributes,
257+
classes,
258+
num_attributes,
259259
num_classes: k,
260260
})
261261
}
262262
Ordering::Greater => {
263263
let x0 = M::zeros(1, (num_attributes + 1) * k);
264264

265265
let objective = MultiClassObjectiveFunction {
266-
x: x,
266+
x,
267267
y: yi,
268-
k: k,
268+
k,
269269
phantom: PhantomData,
270270
};
271271

@@ -275,8 +275,8 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
275275
Ok(LogisticRegression {
276276
coefficients: weights.slice(0..k, 0..num_attributes),
277277
intercept: weights.slice(0..k, num_attributes..num_attributes + 1),
278-
classes: classes,
279-
num_attributes: num_attributes,
278+
classes,
279+
num_attributes,
280280
num_classes: k,
281281
})
282282
}

src/linear/ridge_regression.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ impl<T: RealNumber, M: Matrix<T>> RidgeRegression<T, M> {
129129
let (n, p) = x.shape();
130130

131131
if n <= p {
132-
return Err(Failed::fit(&format!(
132+
return Err(Failed::fit(
133133
"Number of rows in X should be >= number of columns in X"
134-
)));
134+
));
135135
}
136136

137137
if y.len() != n {
138-
return Err(Failed::fit(&format!("Number of rows in X should = len(y)")));
138+
return Err(Failed::fit("Number of rows in X should = len(y)"));
139139
}
140140

141141
let y_column = M::from_row_vector(y.clone()).transpose();

0 commit comments

Comments
 (0)