fix: fix code to be compatible with rand 0.8, following the recommendations of https://rust-random.github.io/book/update-0.8.html and https://docs.rs/getrandom/0.2.2/getrandom/#webassembly-support

This commit is contained in:
Luis Moreno
2021-04-28 16:28:43 -04:00
parent 703dc9688b
commit c295a0d1bb
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ impl<T: RealNumber + Sum> KMeans<T> {
let mut rng = rand::thread_rng();
let (n, m) = data.shape();
let mut y = vec![0; n];
let mut centroid = data.get_row_as_vec(rng.gen_range(0, n));
let mut centroid = data.get_row_as_vec(rng.gen_range(0..n));
let mut d = vec![T::max_value(); n];
+1 -1
View File
@@ -265,7 +265,7 @@ impl<T: RealNumber> RandomForestClassifier<T> {
let size = ((n_samples as f64) / *class_weight_l) as usize;
for _ in 0..size {
let xi: usize = rng.gen_range(0, n_samples);
let xi: usize = rng.gen_range(0..n_samples);
samples[index[xi]] += 1;
}
}
+1 -1
View File
@@ -218,7 +218,7 @@ impl<T: RealNumber> RandomForestRegressor<T> {
let mut rng = rand::thread_rng();
let mut samples = vec![0; nrows];
for _ in 0..nrows {
let xi = rng.gen_range(0, nrows);
let xi = rng.gen_range(0..nrows);
samples[xi] += 1;
}
samples