Skip to content

Commit 74f0d9e

Browse files
Volodymyr OrlovVolodymyr Orlov
authored andcommitted
fix: formatting
1 parent f685f57 commit 74f0d9e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/model_selection/mod.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,22 @@ pub fn cross_val_predict<T, M, H, E, K, F>(
155155
x: &M,
156156
y: &M::RowVector,
157157
parameters: H,
158-
cv: K
158+
cv: K,
159159
) -> Result<M::RowVector, Failed>
160160
where
161161
T: RealNumber,
162162
M: Matrix<T>,
163163
H: Clone,
164164
E: Predictor<M, M::RowVector>,
165165
K: BaseKFold,
166-
F: Fn(&M, &M::RowVector, H) -> Result<E, Failed>
167-
{
168-
let mut y_hat = M::RowVector::zeros(y.len());
169-
166+
F: Fn(&M, &M::RowVector, H) -> Result<E, Failed>,
167+
{
168+
let mut y_hat = M::RowVector::zeros(y.len());
169+
170170
for (train_idx, test_idx) in cv.split(x) {
171171
let train_x = x.take(&train_idx, 0);
172172
let train_y = y.take(&train_idx);
173-
let test_x = x.take(&test_idx, 0);
173+
let test_x = x.take(&test_idx, 0);
174174

175175
let estimator = fit_estimator(&train_x, &train_y, parameters.clone())?;
176176

@@ -348,16 +348,8 @@ mod tests {
348348
..KFold::default()
349349
};
350350

351-
let y_hat = cross_val_predict(
352-
KNNRegressor::fit,
353-
&x,
354-
&y,
355-
Default::default(),
356-
cv
357-
)
358-
.unwrap();
351+
let y_hat = cross_val_predict(KNNRegressor::fit, &x, &y, Default::default(), cv).unwrap();
359352

360353
assert!(mean_absolute_error(&y, &y_hat) < 10.0);
361354
}
362-
363355
}

0 commit comments

Comments
 (0)