mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-08-20 04:00:01 +00:00
Refactor KMeans module to use inbuilt random
This commit is contained in:
parent
5a5baf9716
commit
252c8a3d29
@ -1,7 +1,6 @@
|
||||
use crate::compute::stats::mean_vertical;
|
||||
use crate::matrix::Matrix;
|
||||
use rand::rng;
|
||||
use rand::seq::SliceRandom;
|
||||
use crate::random::prelude::*;
|
||||
|
||||
pub struct KMeans {
|
||||
pub centroids: Matrix<f64>, // (k, n_features)
|
||||
@ -193,7 +192,11 @@ mod tests {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert!(matches_data_point, "Centroid {} (empty cluster) does not match any data point", c);
|
||||
assert!(
|
||||
matches_data_point,
|
||||
"Centroid {} (empty cluster) does not match any data point",
|
||||
c
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -360,5 +363,4 @@ mod tests {
|
||||
assert_eq!(predicted_label.len(), 1);
|
||||
assert!(predicted_label[0] < k);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user