fix: removes unnecessary print statements, fixes broken test

This commit is contained in:
Volodymyr Orlov
2020-09-16 09:16:22 -07:00
parent 01f536d7f7
commit 4ba0cd317a
2 changed files with 0 additions and 6 deletions
-4
View File
@@ -208,10 +208,6 @@ mod tests {
114.2, 115.7, 116.9, 114.2, 115.7, 116.9,
]; ];
let expected_y: Vec<f64> = vec![
85., 88., 88., 89., 97., 98., 99., 99., 102., 104., 109., 110., 113., 114., 115., 116.,
];
let y_hat = RandomForestRegressor::fit( let y_hat = RandomForestRegressor::fit(
&x, &x,
&y, &y,
-2
View File
@@ -143,7 +143,6 @@ impl<T: RealNumber, D: Distance<Vec<T>, T>> KNNRegressor<T, D> {
fn predict_for_row(&self, x: Vec<T>) -> T { fn predict_for_row(&self, x: Vec<T>) -> T {
let search_result = self.knn_algorithm.find(&x, self.k); let search_result = self.knn_algorithm.find(&x, self.k);
println!("{:?}", search_result);
let mut result = T::zero(); let mut result = T::zero();
let weights = self let weights = self
@@ -196,7 +195,6 @@ mod tests {
let y_exp = vec![2., 2., 3., 4., 4.]; let y_exp = vec![2., 2., 3., 4., 4.];
let knn = KNNRegressor::fit(&x, &y, Distances::euclidian(), Default::default()); let knn = KNNRegressor::fit(&x, &y, Distances::euclidian(), Default::default());
let y_hat = knn.predict(&x); let y_hat = knn.predict(&x);
println!("{:?}", y_hat);
assert_eq!(5, Vec::len(&y_hat)); assert_eq!(5, Vec::len(&y_hat));
for i in 0..y_hat.len() { for i in 0..y_hat.len() {
assert!((y_hat[i] - y_exp[i]).abs() < 1e-7); assert!((y_hat[i] - y_exp[i]).abs() < 1e-7);