diff --git a/Cargo.toml b/Cargo.toml index c5552775e..1093c7616 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ approx = "0.4" ndarray = { version = "0.15", features = ["approx"] } ndarray-linalg = { version = "0.16", optional = true } -sprs = { version = "0.11", default-features = false } +sprs = { version = "=0.11.1", default-features = false } thiserror = "1.0" diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index 1b8abbb87..c5a2cacbe 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -24,7 +24,7 @@ version = "1.0" features = ["derive"] [dependencies] -ndarray = { version = "0.15.4", features = ["serde"] } +ndarray = { version = "0.15", features = ["serde"] } ndarray-rand = "0.14.0" argmin = { version = "0.9.0", default-features = false } argmin-math = { version = "0.3", features = ["ndarray_v0_15-nolinalg"] } diff --git a/algorithms/linfa-kernel/Cargo.toml b/algorithms/linfa-kernel/Cargo.toml index 4646cea27..266ce1e0e 100644 --- a/algorithms/linfa-kernel/Cargo.toml +++ b/algorithms/linfa-kernel/Cargo.toml @@ -26,7 +26,7 @@ features = ["std", "derive"] [dependencies] ndarray = "0.15" num-traits = "0.2" -sprs = { version="0.11", default-features = false } +sprs = { version="=0.11.1", default-features = false } linfa = { version = "0.7.0", path = "../.." } linfa-nn = { version = "0.7.0", path = "../linfa-nn" } diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 6f9687aa8..25f030b04 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -29,7 +29,7 @@ ndarray-rand = { version = "0.14" } unicode-normalization = "0.1.8" regex = "1.4.5" encoding = "0.2" -sprs = { version = "0.11.0", default-features = false } +sprs = { version = "=0.11.1", default-features = false } serde_regex = { version = "1.1", optional = true } diff --git a/src/correlation.rs b/src/correlation.rs index e77905813..d157d10b0 100644 --- a/src/correlation.rs +++ b/src/correlation.rs @@ -128,7 +128,7 @@ impl PearsonCorrelation { /// /// * `dataset`: Data for the correlation analysis /// * `num_iter`: optionally number of iterations of the p-value test, if none then no p-value - /// are calculate + /// are calculated /// /// # Example /// @@ -153,7 +153,6 @@ impl PearsonCorrelation { /// lamotrigine +0.47 (0.14) /// blood sugar level /// ``` - pub fn from_dataset, T>( dataset: &DatasetBase, T>, num_iter: Option, diff --git a/src/dataset/impl_dataset.rs b/src/dataset/impl_dataset.rs index b8148793f..cb1e28a90 100644 --- a/src/dataset/impl_dataset.rs +++ b/src/dataset/impl_dataset.rs @@ -208,7 +208,7 @@ where /// println!("{} => {}", x, y); /// } /// ``` - pub fn sample_iter(&'a self) -> Iter<'a, '_, F, T::Elem, T::Ix> { + pub fn sample_iter(&'a self) -> Iter<'a, 'a, F, T::Elem, T::Ix> { Iter::new(self.records.view(), self.targets.as_targets()) } } @@ -232,7 +232,7 @@ where /// /// This iterator produces dataset views with only a single feature, while the set of targets remain /// complete. It can be useful to compare each feature individual to all targets. - pub fn feature_iter(&'a self) -> DatasetIter<'a, '_, ArrayBase, T> { + pub fn feature_iter(&'a self) -> DatasetIter<'a, 'a, ArrayBase, T> { DatasetIter::new(self, true) } @@ -241,7 +241,7 @@ where /// This functions creates an iterator which produces dataset views complete records, but only /// a single target each. Useful to train multiple single target models for a multi-target /// dataset. - pub fn target_iter(&'a self) -> DatasetIter<'a, '_, ArrayBase, T> { + pub fn target_iter(&'a self) -> DatasetIter<'a, 'a, ArrayBase, T> { DatasetIter::new(self, false) } } @@ -318,7 +318,7 @@ impl, R: Records> Labels for DatasetBase { } #[allow(clippy::type_complexity)] -impl<'a, 'b: 'a, F, L: Label, T, D> DatasetBase, T> +impl DatasetBase, T> where D: Data, T: AsSingleTargets + Labels, @@ -680,8 +680,8 @@ where /// - `k`: the number of folds to apply to the dataset /// - `params`: the desired parameters for the fittable algorithm at hand /// - `fit_closure`: a closure of the type `(params, training_data) -> fitted_model` - /// that will be used to produce the trained model for each fold. The training data given in input - /// won't outlive the closure. + /// that will be used to produce the trained model for each fold. The training data given in + /// input won't outlive the closure. /// /// ## Returns /// @@ -732,7 +732,7 @@ where &'a mut self, k: usize, fit_closure: C, - ) -> impl Iterator, ArrayView>)> { + ) -> impl Iterator, ArrayView<'a, E, I>>)> { assert!(k > 0); assert!(k <= self.nsamples()); let samples_count = self.nsamples(); @@ -794,9 +794,9 @@ where /// - `k`: the number of folds to apply /// - `parameters`: a list of models to compare /// - `eval`: closure used to evaluate the performance of each trained model. This closure is - /// called on the model output and validation targets of each fold and outputs the performance - /// score for each target. For single-target dataset the signature is `(Array1, Array1) -> - /// Array0`. For multi-target dataset the signature is `(Array2, Array2) -> Array1`. + /// called on the model output and validation targets of each fold and outputs the performance + /// score for each target. For single-target dataset the signature is `(Array1, Array1) -> + /// Array0`. For multi-target dataset the signature is `(Array2, Array2) -> Array1`. /// /// ### Returns /// diff --git a/src/dataset/mod.rs b/src/dataset/mod.rs index 544d8243a..ab8f5417d 100644 --- a/src/dataset/mod.rs +++ b/src/dataset/mod.rs @@ -161,7 +161,7 @@ impl Deref for Pr { /// # Fields /// /// * `records`: a two-dimensional matrix with dimensionality (nsamples, nfeatures), in case of -/// kernel methods a quadratic matrix with dimensionality (nsamples, nsamples), which may be sparse +/// kernel methods a quadratic matrix with dimensionality (nsamples, nsamples), which may be sparse /// * `targets`: a two-/one-dimension matrix with dimensionality (nsamples, ntargets) /// * `weights`: optional weights for each sample with dimensionality (nsamples) /// * `feature_names`: optional descriptive feature names with dimensionality (nfeatures) @@ -170,7 +170,7 @@ impl Deref for Pr { /// /// * `R: Records`: generic over feature matrices or kernel matrices /// * `T`: generic over any `ndarray` matrix which can be used as targets. The `AsTargets` trait -/// bound is omitted here to avoid some repetition in implementation `src/dataset/impl_dataset.rs` +/// bound is omitted here to avoid some repetition in implementation `src/dataset/impl_dataset.rs` #[derive(Debug, Clone, PartialEq)] pub struct DatasetBase where diff --git a/src/metrics_clustering.rs b/src/metrics_clustering.rs index b49f4c5be..5eab97cb8 100644 --- a/src/metrics_clustering.rs +++ b/src/metrics_clustering.rs @@ -63,9 +63,8 @@ impl DistanceCount { } impl< - 'a, F: Float, - L: 'a + Label, + L: Label, D: Data, T: AsSingleTargets + Labels, > SilhouetteScore for DatasetBase, T>