fix: changes recommended by Clippy
This commit is contained in:
@@ -111,7 +111,7 @@ impl<T: RealNumber, M: Matrix<T>> PartialEq for LogisticRegression<T, M> {
|
||||
}
|
||||
}
|
||||
|
||||
return self.coefficients == other.coefficients && self.intercept == other.intercept;
|
||||
self.coefficients == other.coefficients && self.intercept == other.intercept
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
|
||||
let x0 = M::zeros(1, num_attributes + 1);
|
||||
|
||||
let objective = BinaryObjectiveFunction {
|
||||
x: x,
|
||||
x,
|
||||
y: yi,
|
||||
phantom: PhantomData,
|
||||
};
|
||||
@@ -254,8 +254,8 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
|
||||
Ok(LogisticRegression {
|
||||
coefficients: weights.slice(0..1, 0..num_attributes),
|
||||
intercept: weights.slice(0..1, num_attributes..num_attributes + 1),
|
||||
classes: classes,
|
||||
num_attributes: num_attributes,
|
||||
classes,
|
||||
num_attributes,
|
||||
num_classes: k,
|
||||
})
|
||||
}
|
||||
@@ -263,9 +263,9 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
|
||||
let x0 = M::zeros(1, (num_attributes + 1) * k);
|
||||
|
||||
let objective = MultiClassObjectiveFunction {
|
||||
x: x,
|
||||
x,
|
||||
y: yi,
|
||||
k: k,
|
||||
k,
|
||||
phantom: PhantomData,
|
||||
};
|
||||
|
||||
@@ -275,8 +275,8 @@ impl<T: RealNumber, M: Matrix<T>> LogisticRegression<T, M> {
|
||||
Ok(LogisticRegression {
|
||||
coefficients: weights.slice(0..k, 0..num_attributes),
|
||||
intercept: weights.slice(0..k, num_attributes..num_attributes + 1),
|
||||
classes: classes,
|
||||
num_attributes: num_attributes,
|
||||
classes,
|
||||
num_attributes,
|
||||
num_classes: k,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -129,13 +129,13 @@ impl<T: RealNumber, M: Matrix<T>> RidgeRegression<T, M> {
|
||||
let (n, p) = x.shape();
|
||||
|
||||
if n <= p {
|
||||
return Err(Failed::fit(&format!(
|
||||
return Err(Failed::fit(
|
||||
"Number of rows in X should be >= number of columns in X"
|
||||
)));
|
||||
));
|
||||
}
|
||||
|
||||
if y.len() != n {
|
||||
return Err(Failed::fit(&format!("Number of rows in X should = len(y)")));
|
||||
return Err(Failed::fit("Number of rows in X should = len(y)"));
|
||||
}
|
||||
|
||||
let y_column = M::from_row_vector(y.clone()).transpose();
|
||||
|
||||
Reference in New Issue
Block a user