From 3a3033d913c9e633c6c4f91a949621b4b42afcc6 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:00:45 +0100 Subject: [PATCH 01/28] Bump ndarray version to 0.16 --- Cargo.toml | 2 +- algorithms/linfa-bayes/Cargo.toml | 6 ++++-- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-hierarchical/Cargo.toml | 14 +++++++++++--- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-kernel/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-logistic/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- algorithms/linfa-svm/Cargo.toml | 2 +- algorithms/linfa-trees/Cargo.toml | 6 ++++-- algorithms/linfa-tsne/Cargo.toml | 6 ++++-- datasets/Cargo.toml | 2 +- 18 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d284d10da..095e382c5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ num-traits = "0.2" rand = { version = "0.8", features = ["small_rng"] } approx = "0.4" -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.16", optional = true } sprs = { version = "=0.11.1", default-features = false } diff --git a/algorithms/linfa-bayes/Cargo.toml b/algorithms/linfa-bayes/Cargo.toml index 5030a7e45..3fd2ed472 100644 --- a/algorithms/linfa-bayes/Cargo.toml +++ b/algorithms/linfa-bayes/Cargo.toml @@ -21,7 +21,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15" , features = ["approx"]} +ndarray = { version = "0.16", features = ["approx"] } ndarray-stats = "0.5" thiserror = "1.0" @@ -29,4 +29,6 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] approx = "0.4" -linfa-datasets = { version = "0.7.1", path = "../../datasets", features = ["winequality"] } +linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ + "winequality", +] } diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 136224c85..c7204e9ee 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -35,7 +35,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["rayon", "approx"] } +ndarray = { version = "0.16", features = ["rayon", "approx"] } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.16", optional = true } ndarray-rand = "0.14" diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index 2148c0d11..807e521f4 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -29,7 +29,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.16", optional = true } diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index d8239941c..cf5426636 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", features = ["serde"] } +ndarray = { version = "0.16", 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-hierarchical/Cargo.toml b/algorithms/linfa-hierarchical/Cargo.toml index f8aafb7cd..2caf0e1c9 100644 --- a/algorithms/linfa-hierarchical/Cargo.toml +++ b/algorithms/linfa-hierarchical/Cargo.toml @@ -10,11 +10,17 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rust-ml/linfa" readme = "README.md" -keywords = ["hierachical", "agglomerative", "clustering", "machine-learning", "linfa"] +keywords = [ + "hierachical", + "agglomerative", + "clustering", + "machine-learning", + "linfa", +] categories = ["algorithms", "mathematics", "science"] [dependencies] -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } kodama = "0.2" thiserror = "1.0.25" @@ -24,4 +30,6 @@ linfa-kernel = { version = "0.7.1", path = "../linfa-kernel" } [dev-dependencies] rand = "0.8" ndarray-rand = "0.14" -linfa-datasets = { version = "0.7.1", path = "../../datasets", features = ["iris"] } +linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ + "iris", +] } diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 7dcdb7561..bf6c8649b 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -25,7 +25,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.16", optional = true } ndarray-rand = "0.14" diff --git a/algorithms/linfa-kernel/Cargo.toml b/algorithms/linfa-kernel/Cargo.toml index 5d86ab1d3..8bf490081 100644 --- a/algorithms/linfa-kernel/Cargo.toml +++ b/algorithms/linfa-kernel/Cargo.toml @@ -24,7 +24,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = "0.15" +ndarray = "0.16" num-traits = "0.2" sprs = { version = "=0.11.1", default-features = false } diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 0c9f7ec6d..63de16242 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -29,7 +29,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.16", optional = true } num-traits = "0.2" diff --git a/algorithms/linfa-logistic/Cargo.toml b/algorithms/linfa-logistic/Cargo.toml index 4effb439f..3644c08f8 100644 --- a/algorithms/linfa-logistic/Cargo.toml +++ b/algorithms/linfa-logistic/Cargo.toml @@ -23,7 +23,7 @@ optional = true version = "1.0" [dependencies] -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } ndarray-stats = "0.5.0" num-traits = "0.2" argmin = { version = "0.9.0", default-features = false } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index d982f8998..70f6adac5 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -24,7 +24,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["approx"]} +ndarray = { version = "0.16", features = ["approx"] } ndarray-stats = "0.5" num-traits = "0.2.0" noisy_float = "0.2.0" diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 13002b8ad..4ea68ed96 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -25,7 +25,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.16", optional = true } ndarray-stats = "0.5" diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 5e6aff735..fbb3719b8 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -19,7 +19,7 @@ serde = ["serde_crate", "ndarray/serde", "serde_regex"] [dependencies] linfa = { version = "0.7.1", path = "../.." } -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.16", optional = true } linfa-linalg = { version = "0.1", default-features = false } ndarray-stats = "0.5" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index c1de0c2f9..726012425 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -34,7 +34,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["approx"] } +ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1" } ndarray-linalg = { version = "0.16", optional = true } ndarray-rand = "0.14" diff --git a/algorithms/linfa-svm/Cargo.toml b/algorithms/linfa-svm/Cargo.toml index c99784495..81349a661 100644 --- a/algorithms/linfa-svm/Cargo.toml +++ b/algorithms/linfa-svm/Cargo.toml @@ -24,7 +24,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } ndarray-rand = "0.14" num-traits = "0.2" thiserror = "1.0" diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index a270ec6af..6046c6f47 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -24,7 +24,7 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15" , features = ["rayon", "approx"]} +ndarray = { version = "0.16", features = ["rayon", "approx"] } ndarray-rand = "0.14" linfa = { version = "0.7.1", path = "../.." } @@ -33,7 +33,9 @@ linfa = { version = "0.7.1", path = "../.." } rand = { version = "0.8", features = ["small_rng"] } criterion = "0.4.0" approx = "0.4" -linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = ["iris"] } +linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ + "iris", +] } linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-tsne/Cargo.toml b/algorithms/linfa-tsne/Cargo.toml index 2cb7ebe7d..4487990a5 100644 --- a/algorithms/linfa-tsne/Cargo.toml +++ b/algorithms/linfa-tsne/Cargo.toml @@ -15,7 +15,7 @@ categories = ["algorithms", "mathematics", "science"] [dependencies] thiserror = "1.0" -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } ndarray-rand = "0.14" bhtsne = "0.4.0" pdqselect = "=0.1.0" @@ -26,7 +26,9 @@ linfa = { version = "0.7.1", path = "../.." } rand = "0.8" approx = "0.4" -linfa-datasets = { version = "0.7.1", path = "../../datasets", features = ["iris"] } +linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ + "iris", +] } linfa-reduction = { version = "0.7.1", path = "../linfa-reduction" } [target.'cfg(not(target_family = "windows"))'.dev-dependencies] diff --git a/datasets/Cargo.toml b/datasets/Cargo.toml index 77dbdd587..e4631f6b9 100644 --- a/datasets/Cargo.toml +++ b/datasets/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/rust-ml/linfa" [dependencies] linfa = { version = "0.7.1", path = ".." } -ndarray = { version = "0.15" } +ndarray = { version = "0.16" } ndarray-csv = "=0.5.1" csv = "1.1" flate2 = "1.0" From d4ff5694ca8785bb669e409e9aed53aee5fd3805 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:02:28 +0100 Subject: [PATCH 02/28] Bump ndarray-linalg version to 0.17 --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 095e382c5..00b3b3036 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ rand = { version = "0.8", features = ["small_rng"] } approx = "0.4" ndarray = { version = "0.16", features = ["approx"] } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } sprs = { version = "=0.11.1", default-features = false } thiserror = "1.0" diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index c7204e9ee..e84cd239f 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -37,7 +37,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["rayon", "approx"] } linfa-linalg = { version = "0.1", default-features = false } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.14" ndarray-stats = "0.5" num-traits = "0.2" diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index 807e521f4..5a0912add 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -31,7 +31,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1", default-features = false } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" approx = "0.4" diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index bf6c8649b..93c16bbb7 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -27,7 +27,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.14" ndarray-stats = "0.5" num-traits = "0.2" diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 63de16242..1f18cee3d 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -31,7 +31,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1", default-features = false } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" argmin = { version = "0.9.0", default-features = false } argmin-math = { version = "0.3", features = ["ndarray_v0_15-nolinalg"] } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 4ea68ed96..973c6c6ab 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -27,7 +27,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } ndarray-stats = "0.5" ndarray-rand = "0.14" num-traits = "0.2" diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index fbb3719b8..e3fdb2697 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -20,7 +20,7 @@ serde = ["serde_crate", "ndarray/serde", "serde_regex"] [dependencies] linfa = { version = "0.7.1", path = "../.." } ndarray = { version = "0.16", features = ["approx"] } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } linfa-linalg = { version = "0.1", default-features = false } ndarray-stats = "0.5" thiserror = "1.0" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index 726012425..84205e209 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -36,7 +36,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1" } -ndarray-linalg = { version = "0.16", optional = true } +ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.14" num-traits = "0.2" thiserror = "1.0" From eb4c5cebea2f25d9a1792bab6b04d4058514a746 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:06:28 +0100 Subject: [PATCH 03/28] Bump ndarray-stats version to 0.6 --- algorithms/linfa-bayes/Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/algorithms/linfa-bayes/Cargo.toml b/algorithms/linfa-bayes/Cargo.toml index 3fd2ed472..cd03aacae 100644 --- a/algorithms/linfa-bayes/Cargo.toml +++ b/algorithms/linfa-bayes/Cargo.toml @@ -22,7 +22,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } -ndarray-stats = "0.5" +ndarray-stats = "0.6" thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index e84cd239f..b7d89aa09 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -39,7 +39,7 @@ ndarray = { version = "0.16", features = ["rayon", "approx"] } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.14" -ndarray-stats = "0.5" +ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" space = "0.12" diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 93c16bbb7..85bba34f5 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -29,7 +29,7 @@ ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.14" -ndarray-stats = "0.5" +ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" thiserror = "1.0" diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index 70f6adac5..898999a1a 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -25,7 +25,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } -ndarray-stats = "0.5" +ndarray-stats = "0.6" num-traits = "0.2.0" noisy_float = "0.2.0" order-stat = "0.1.3" diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 973c6c6ab..cbe817022 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -28,7 +28,7 @@ features = ["std", "derive"] ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } -ndarray-stats = "0.5" +ndarray-stats = "0.6" ndarray-rand = "0.14" num-traits = "0.2" paste = "1.0" diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index e3fdb2697..73748c998 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -22,7 +22,7 @@ linfa = { version = "0.7.1", path = "../.." } ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } linfa-linalg = { version = "0.1", default-features = false } -ndarray-stats = "0.5" +ndarray-stats = "0.6" thiserror = "1.0" approx = { version = "0.4" } ndarray-rand = { version = "0.14" } From f0917ea96b8d6b53b6813aab2b60d5beb4022e2f Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:09:11 +0100 Subject: [PATCH 04/28] Bump ndarray-rand version to 0.15 --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-hierarchical/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- algorithms/linfa-svm/Cargo.toml | 2 +- algorithms/linfa-trees/Cargo.toml | 2 +- algorithms/linfa-tsne/Cargo.toml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 00b3b3036..a8206615c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ default-features = false features = ["std", "derive"] [dev-dependencies] -ndarray-rand = "0.14" +ndarray-rand = "0.15" linfa-datasets = { path = "datasets", features = [ "winequality", "iris", diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index b7d89aa09..2385098ff 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -38,7 +38,7 @@ features = ["std", "derive"] ndarray = { version = "0.16", features = ["rayon", "approx"] } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } -ndarray-rand = "0.14" +ndarray-rand = "0.15" ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index 5a0912add..e669ab98e 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -44,5 +44,5 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", "linnerud", ] } -ndarray-rand = "0.14" +ndarray-rand = "0.15" rand_xoshiro = "0.6" diff --git a/algorithms/linfa-hierarchical/Cargo.toml b/algorithms/linfa-hierarchical/Cargo.toml index 2caf0e1c9..bf658cd20 100644 --- a/algorithms/linfa-hierarchical/Cargo.toml +++ b/algorithms/linfa-hierarchical/Cargo.toml @@ -29,7 +29,7 @@ linfa-kernel = { version = "0.7.1", path = "../linfa-kernel" } [dev-dependencies] rand = "0.8" -ndarray-rand = "0.14" +ndarray-rand = "0.15" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "iris", ] } diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 85bba34f5..b294ab3a1 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -28,7 +28,7 @@ features = ["std", "derive"] ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } -ndarray-rand = "0.14" +ndarray-rand = "0.15" ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index 898999a1a..60d806d50 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -39,7 +39,7 @@ linfa = { version = "0.7.1", path = "../.." } approx = "0.4" criterion = "0.4.0" rand_xoshiro = "0.6" -ndarray-rand = "0.14" +ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index cbe817022..9253abf88 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -29,7 +29,7 @@ ndarray = { version = "0.16" } linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-stats = "0.6" -ndarray-rand = "0.14" +ndarray-rand = "0.15" num-traits = "0.2" paste = "1.0" thiserror = "1.0" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index 84205e209..2fe7b6095 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -37,7 +37,7 @@ features = ["std", "derive"] ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.1" } ndarray-linalg = { version = "0.17", optional = true } -ndarray-rand = "0.14" +ndarray-rand = "0.15" num-traits = "0.2" thiserror = "1.0" rand = { version = "0.8", features = ["small_rng"] } diff --git a/algorithms/linfa-svm/Cargo.toml b/algorithms/linfa-svm/Cargo.toml index 81349a661..e2fb66d4c 100644 --- a/algorithms/linfa-svm/Cargo.toml +++ b/algorithms/linfa-svm/Cargo.toml @@ -25,7 +25,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16" } -ndarray-rand = "0.14" +ndarray-rand = "0.15" num-traits = "0.2" thiserror = "1.0" diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index 6046c6f47..642fd0069 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -25,7 +25,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["rayon", "approx"] } -ndarray-rand = "0.14" +ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-tsne/Cargo.toml b/algorithms/linfa-tsne/Cargo.toml index 4487990a5..1e92845e7 100644 --- a/algorithms/linfa-tsne/Cargo.toml +++ b/algorithms/linfa-tsne/Cargo.toml @@ -16,7 +16,7 @@ categories = ["algorithms", "mathematics", "science"] [dependencies] thiserror = "1.0" ndarray = { version = "0.16" } -ndarray-rand = "0.14" +ndarray-rand = "0.15" bhtsne = "0.4.0" pdqselect = "=0.1.0" From b4accdd7e365f6a58ec189d0012f71fbe042157b Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:14:43 +0100 Subject: [PATCH 05/28] Unpin ndarray-csv --- datasets/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datasets/Cargo.toml b/datasets/Cargo.toml index e4631f6b9..ba605ad8e 100644 --- a/datasets/Cargo.toml +++ b/datasets/Cargo.toml @@ -10,10 +10,10 @@ repository = "https://github.com/rust-ml/linfa" [dependencies] linfa = { version = "0.7.1", path = ".." } ndarray = { version = "0.16" } -ndarray-csv = "=0.5.1" +ndarray-csv = "0.5" csv = "1.1" flate2 = "1.0" -ndarray-rand = { version = "0.14", optional = true } +ndarray-rand = { version = "0.15", optional = true } [dev-dependencies] approx = "0.4" From dc9405739ef6ced1e3d056fae004abeb84facdd9 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:16:12 +0100 Subject: [PATCH 06/28] Bump approx version to 0.5 --- Cargo.toml | 2 +- algorithms/linfa-bayes/Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-logistic/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-svm/Cargo.toml | 2 +- algorithms/linfa-trees/Cargo.toml | 2 +- algorithms/linfa-tsne/Cargo.toml | 2 +- datasets/Cargo.toml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a8206615c..9ba95025a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ serde = ["serde_crate", "ndarray/serde"] [dependencies] num-traits = "0.2" rand = { version = "0.8", features = ["small_rng"] } -approx = "0.4" +approx = "0.5" ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } diff --git a/algorithms/linfa-bayes/Cargo.toml b/algorithms/linfa-bayes/Cargo.toml index cd03aacae..ae7e48654 100644 --- a/algorithms/linfa-bayes/Cargo.toml +++ b/algorithms/linfa-bayes/Cargo.toml @@ -28,7 +28,7 @@ thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -approx = "0.4" +approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", ] } diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 2385098ff..04c9a75d8 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -56,7 +56,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } criterion = "0.4.0" serde_json = "1" -approx = "0.4" +approx = "0.5" lax = "0.15.0" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index e669ab98e..cbf505825 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -34,7 +34,7 @@ linfa-linalg = { version = "0.1", default-features = false } ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" -approx = "0.4" +approx = "0.5" thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index cf5426636..daf95440c 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -36,7 +36,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] criterion = "0.4.0" -approx = "0.4" +approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", ] } diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 1f18cee3d..00fad5aa9 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -43,7 +43,7 @@ linfa = { version = "0.7.1", path = "../.." } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } -approx = "0.4" +approx = "0.5" criterion = "0.4.0" statrs = "0.16.0" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-logistic/Cargo.toml b/algorithms/linfa-logistic/Cargo.toml index 3644c08f8..edc679eaa 100644 --- a/algorithms/linfa-logistic/Cargo.toml +++ b/algorithms/linfa-logistic/Cargo.toml @@ -33,7 +33,7 @@ thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -approx = "0.4" +approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", ] } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index 60d806d50..bc3d2f245 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -36,7 +36,7 @@ kdtree = "0.7.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -approx = "0.4" +approx = "0.5" criterion = "0.4.0" rand_xoshiro = "0.6" ndarray-rand = "0.15" diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 9253abf88..9db9c6488 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -40,7 +40,7 @@ linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "linnerud", ] } -approx = "0.4" +approx = "0.5" rand_xoshiro = "0.6" criterion = "0.4.0" statrs = "0.16.0" diff --git a/algorithms/linfa-svm/Cargo.toml b/algorithms/linfa-svm/Cargo.toml index e2fb66d4c..d220cf9f0 100644 --- a/algorithms/linfa-svm/Cargo.toml +++ b/algorithms/linfa-svm/Cargo.toml @@ -38,4 +38,4 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } rand_xoshiro = "0.6" -approx = "0.4" +approx = "0.5" diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index 642fd0069..b0907c339 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -32,7 +32,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } criterion = "0.4.0" -approx = "0.4" +approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ "iris", ] } diff --git a/algorithms/linfa-tsne/Cargo.toml b/algorithms/linfa-tsne/Cargo.toml index 1e92845e7..0d860d3c2 100644 --- a/algorithms/linfa-tsne/Cargo.toml +++ b/algorithms/linfa-tsne/Cargo.toml @@ -24,7 +24,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = "0.8" -approx = "0.4" +approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "iris", diff --git a/datasets/Cargo.toml b/datasets/Cargo.toml index ba605ad8e..5ded9426f 100644 --- a/datasets/Cargo.toml +++ b/datasets/Cargo.toml @@ -16,7 +16,7 @@ flate2 = "1.0" ndarray-rand = { version = "0.15", optional = true } [dev-dependencies] -approx = "0.4" +approx = "0.5" statrs = "0.16.0" [features] From 3d7487d2cf72356063d04d38820baa96f22575b1 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:17:59 +0100 Subject: [PATCH 07/28] Bump linfa-linalg version to 0.2 --- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 04c9a75d8..f1e393a88 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -36,7 +36,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["rayon", "approx"] } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.15" ndarray-stats = "0.6" diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index cbf505825..aedf9fa7b 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -30,7 +30,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index b294ab3a1..ea0d82354 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -26,7 +26,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16" } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.15" ndarray-stats = "0.6" diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 00fad5aa9..0421b49d9 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -30,7 +30,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" argmin = { version = "0.9.0", default-features = false } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 9db9c6488..368a825a3 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -26,7 +26,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16" } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } ndarray-stats = "0.6" ndarray-rand = "0.15" diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 73748c998..bf61859a4 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -21,7 +21,7 @@ serde = ["serde_crate", "ndarray/serde", "serde_regex"] linfa = { version = "0.7.1", path = "../.." } ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } -linfa-linalg = { version = "0.1", default-features = false } +linfa-linalg = { version = "0.2", default-features = false } ndarray-stats = "0.6" thiserror = "1.0" approx = { version = "0.4" } diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index 2fe7b6095..00f2fdb33 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -35,7 +35,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } -linfa-linalg = { version = "0.1" } +linfa-linalg = { version = "0.2" } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.15" num-traits = "0.2" From f057427d0dd67e012fdabdaefc7ef0a63681f7fc Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 17:23:46 +0100 Subject: [PATCH 08/28] Unpin sprs --- Cargo.toml | 2 +- algorithms/linfa-kernel/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9ba95025a..61b8475ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ approx = "0.5" ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } -sprs = { version = "=0.11.1", default-features = false } +sprs = { version = "0.11", default-features = false } thiserror = "1.0" diff --git a/algorithms/linfa-kernel/Cargo.toml b/algorithms/linfa-kernel/Cargo.toml index 8bf490081..b910926ad 100644 --- a/algorithms/linfa-kernel/Cargo.toml +++ b/algorithms/linfa-kernel/Cargo.toml @@ -26,7 +26,7 @@ features = ["std", "derive"] [dependencies] ndarray = "0.16" num-traits = "0.2" -sprs = { version = "=0.11.1", default-features = false } +sprs = { version = "0.11", default-features = false } linfa = { version = "0.7.1", path = "../.." } linfa-nn = { version = "0.7.2", path = "../linfa-nn" } diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index bf61859a4..ad0e74d64 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.1", default-features = false } +sprs = { version = "0.11", default-features = false } serde_regex = { version = "1.1", optional = true } itertools = "0.14.0" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index 00f2fdb33..7d0c84e11 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -44,7 +44,7 @@ rand = { version = "0.8", features = ["small_rng"] } linfa = { version = "0.7.1", path = "../.." } linfa-kernel = { version = "0.7.1", path = "../linfa-kernel" } -sprs = "=0.11.1" +sprs = { version = "0.11" } rand_xoshiro = "0.6.0" [dev-dependencies] From 9b0ae0d3d4269511f67094b82cb0f0f176bd7111 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 18:51:53 +0100 Subject: [PATCH 09/28] Fix forgotten bumps --- algorithms/linfa-clustering/Cargo.toml | 4 ++-- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 4 ++-- algorithms/linfa-reduction/Cargo.toml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index f1e393a88..3d1684a52 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -50,14 +50,14 @@ linfa-nn = { version = "0.7.2", path = "../linfa-nn" } noisy_float = "0.2.0" [dev-dependencies] -ndarray-npy = { version = "0.8", default-features = false } +ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "generate", ] } criterion = "0.4.0" serde_json = "1" approx = "0.5" -lax = "0.15.0" +lax = "0.17.0" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index ea0d82354..d33da9be6 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -37,7 +37,7 @@ thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -ndarray-npy = { version = "0.8", default-features = false } +ndarray-npy = { version = "0.9", default-features = false } paste = "1.0" criterion = "0.4.0" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index ad0e74d64..8d642d06d 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -24,8 +24,8 @@ ndarray-linalg = { version = "0.17", optional = true } linfa-linalg = { version = "0.2", default-features = false } ndarray-stats = "0.6" thiserror = "1.0" -approx = { version = "0.4" } -ndarray-rand = { version = "0.14" } +approx = "0.5" +ndarray-rand = "0.15" unicode-normalization = "0.1.8" regex = "1.4.5" encoding = "0.2" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index 7d0c84e11..c658a957c 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -48,11 +48,11 @@ sprs = { version = "0.11" } rand_xoshiro = "0.6.0" [dev-dependencies] -ndarray-npy = { version = "0.8", default-features = false } +ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "iris", "generate", ] } -approx = { version = "0.4" } +approx = "0.5" mnist = { version = "0.6.0", features = ["download"] } linfa-trees = { version = "0.7.1", path = "../linfa-trees" } From 73ea8a07142f851665631b1819bdb074dc092332 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 19:31:12 +0100 Subject: [PATCH 10/28] Fix deprecated into_shape() --- .../src/gaussian_mixture/algorithm.rs | 2 +- .../linfa-svm/examples/noisy_sin_svr.rs | 2 +- algorithms/linfa-svm/src/regression.rs | 20 +++++++++++++------ src/composing/multi_target_model.rs | 2 +- src/dataset/impl_dataset.rs | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs b/algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs index 892007335..27341a9f5 100644 --- a/algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs +++ b/algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs @@ -396,7 +396,7 @@ impl GaussianMixtureModel { let n_clusters = matrix_chol.shape()[0]; let log_diags = &matrix_chol .to_owned() - .into_shape((n_clusters, n_features * n_features)) + .into_shape_with_order((n_clusters, n_features * n_features)) .unwrap() .slice(s![.., ..; n_features+1]) .to_owned() diff --git a/algorithms/linfa-svm/examples/noisy_sin_svr.rs b/algorithms/linfa-svm/examples/noisy_sin_svr.rs index d51bb3f9b..fab43585c 100644 --- a/algorithms/linfa-svm/examples/noisy_sin_svr.rs +++ b/algorithms/linfa-svm/examples/noisy_sin_svr.rs @@ -23,7 +23,7 @@ fn main() -> Result<()> { .filter(|(i, _)| i % 5 == 0) .for_each(|(_, y)| *y = 3. * (0.5 - rng.gen::())); - let x = x.into_shape((40, 1)).unwrap(); + let x = x.into_shape_with_order((40, 1)).unwrap(); let dataset = DatasetBase::new(x, y); let model = Svm::params() .c_svr(100., Some(0.1)) diff --git a/algorithms/linfa-svm/src/regression.rs b/algorithms/linfa-svm/src/regression.rs index ffca11549..e96454438 100644 --- a/algorithms/linfa-svm/src/regression.rs +++ b/algorithms/linfa-svm/src/regression.rs @@ -221,7 +221,7 @@ pub mod tests { fn test_epsilon_regression_linear() -> Result<()> { // simple 2d straight line let targets = Array::linspace(0f64, 10., 100); - let records = targets.clone().into_shape((100, 1)).unwrap(); + let records = targets.clone().into_shape_with_order((100, 1)).unwrap(); let dataset = Dataset::new(records, targets); let model = Svm::params() @@ -245,7 +245,7 @@ pub mod tests { fn test_nu_regression_linear() -> Result<()> { // simple 2d straight line let targets = Array::linspace(0f64, 10., 100); - let records = targets.clone().into_shape((100, 1)).unwrap(); + let records = targets.clone().into_shape_with_order((100, 1)).unwrap(); let dataset = Dataset::new(records, targets); // Test the precomputed dot product in the linear kernel case @@ -268,9 +268,12 @@ pub mod tests { #[test] fn test_epsilon_regression_gaussian() -> Result<()> { let records = Array::linspace(0f64, 10., 100) - .into_shape((100, 1)) + .into_shape_with_order((100, 1)) + .unwrap(); + let sin_curve = records + .mapv(|v| v.sin()) + .into_shape_with_order((100,)) .unwrap(); - let sin_curve = records.mapv(|v| v.sin()).into_shape((100,)).unwrap(); let dataset = Dataset::new(records, sin_curve); let model = Svm::params() @@ -285,8 +288,13 @@ pub mod tests { #[test] fn test_nu_regression_polynomial() -> Result<()> { let n = 100; - let records = Array::linspace(0f64, 5., n).into_shape((n, 1)).unwrap(); - let sin_curve = records.mapv(|v| v.sin()).into_shape((n,)).unwrap(); + let records = Array::linspace(0f64, 5., n) + .into_shape_with_order((n, 1)) + .unwrap(); + let sin_curve = records + .mapv(|v| v.sin()) + .into_shape_with_order((n,)) + .unwrap(); let dataset = Dataset::new(records, sin_curve); let model = Svm::params() diff --git a/src/composing/multi_target_model.rs b/src/composing/multi_target_model.rs index 31341d184..3ffaac34a 100644 --- a/src/composing/multi_target_model.rs +++ b/src/composing/multi_target_model.rs @@ -49,7 +49,7 @@ impl> PredictInplace, Array2< targets.into_raw_vec() }) .collect::>() - .into_shape((self.models.len(), arr.len_of(Axis(0)))) + .into_shape_with_order((self.models.len(), arr.len_of(Axis(0)))) .unwrap() .reversed_axes(); } diff --git a/src/dataset/impl_dataset.rs b/src/dataset/impl_dataset.rs index 81202932a..c4a377747 100644 --- a/src/dataset/impl_dataset.rs +++ b/src/dataset/impl_dataset.rs @@ -124,7 +124,7 @@ impl Dataset { // Convert 2D targets to 1D. Only works for targets with shape of form [X, 1], panics otherwise. pub fn into_single_target(self) -> Dataset { let nsamples = self.records.nsamples(); - let targets = self.targets.into_shape(nsamples).unwrap(); + let targets = self.targets.into_shape_with_order(nsamples).unwrap(); let features = self.records; Dataset::new(features, targets) } From 8cd7ce2c339f74786bcf3ea905ce73bcac63358c Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 20:36:38 +0100 Subject: [PATCH 11/28] Fix deprecated into_raw_vec() --- src/composing/multi_target_model.rs | 7 ++++++- src/dataset/impl_dataset.rs | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/composing/multi_target_model.rs b/src/composing/multi_target_model.rs index 3ffaac34a..86c73d3e1 100644 --- a/src/composing/multi_target_model.rs +++ b/src/composing/multi_target_model.rs @@ -40,13 +40,18 @@ impl> PredictInplace, Array2< &[arr.nrows(), self.models.len()], "The number of data points must match the number of output targets." ); + assert!( + targets.is_standard_layout(), + "targets not in row-major layout" + ); *targets = self .models .iter() .flat_map(|model| { let mut targets = Array1::default(arr.nrows()); model.predict_inplace(arr, &mut targets); - targets.into_raw_vec() + let (v, _) = targets.into_raw_vec_and_offset(); + v }) .collect::>() .into_shape_with_order((self.models.len(), arr.len_of(Axis(0)))) diff --git a/src/dataset/impl_dataset.rs b/src/dataset/impl_dataset.rs index c4a377747..4559d362c 100644 --- a/src/dataset/impl_dataset.rs +++ b/src/dataset/impl_dataset.rs @@ -993,7 +993,7 @@ impl Dataset { let target_names = self.target_names().to_vec(); // split records into two disjoint arrays - let mut array_buf = self.records.into_raw_vec(); + let (mut array_buf, _) = self.records.into_raw_vec_and_offset(); let second_array_buf = array_buf.split_off(n1 * nfeatures); let first = Array2::from_shape_vec((n1, nfeatures), array_buf).unwrap(); @@ -1002,7 +1002,7 @@ impl Dataset { // split targets into two disjoint Vec let dim1 = self.targets.raw_dim().nsamples(n1); let dim2 = self.targets.raw_dim().nsamples(n2); - let mut array_buf = self.targets.into_raw_vec(); + let (mut array_buf, _) = self.targets.into_raw_vec_and_offset(); let second_array_buf = array_buf.split_off(dim1.size()); let first_targets = Array::from_shape_vec(dim1, array_buf).unwrap(); @@ -1010,7 +1010,7 @@ impl Dataset { // split weights into two disjoint Vec let second_weights = if self.weights.len() == n1 + n2 { - let mut weights = self.weights.into_raw_vec(); + let (mut weights, _) = self.weights.into_raw_vec_and_offset(); let weights2 = weights.split_off(n1); self.weights = Array1::from(weights); From 69130f0ee2c5d056f161d33647b516ca02f97fd8 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 29 Jan 2025 21:13:17 +0100 Subject: [PATCH 12/28] Fix deprecated into_shape() --- algorithms/linfa-logistic/src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/algorithms/linfa-logistic/src/lib.rs b/algorithms/linfa-logistic/src/lib.rs index 833dbab0b..49f068aca 100644 --- a/algorithms/linfa-logistic/src/lib.rs +++ b/algorithms/linfa-logistic/src/lib.rs @@ -476,9 +476,9 @@ fn logistic_loss>( ) -> F { let n_features = x.shape()[1]; let (params, intercept) = convert_params(n_features, w); - let yz = x.dot(¶ms.into_shape((params.len(), 1)).unwrap()) + intercept; + let yz = x.dot(¶ms.into_shape_with_order((params.len(), 1)).unwrap()) + intercept; let len = yz.len(); - let mut yz = yz.into_shape(len).unwrap() * y; + let mut yz = yz.into_shape_with_order(len).unwrap() * y; yz.mapv_inplace(log_logistic); -yz.sum() + F::cast(0.5) * alpha * params.dot(¶ms) } @@ -492,9 +492,9 @@ fn logistic_grad>( ) -> Array1 { let n_features = x.shape()[1]; let (params, intercept) = convert_params(n_features, w); - let yz = x.dot(¶ms.into_shape((params.len(), 1)).unwrap()) + intercept; + let yz = x.dot(¶ms.into_shape_with_order((params.len(), 1)).unwrap()) + intercept; let len = yz.len(); - let mut yz = yz.into_shape(len).unwrap() * y; + let mut yz = yz.into_shape_with_order(len).unwrap() * y; yz.mapv_inplace(logistic); yz -= F::one(); yz *= y; @@ -523,7 +523,10 @@ fn multi_logistic_prob_params<'a, F: Float, A: Data>( let h = x.dot(¶ms) + intercept; // This computes `H - log(sum(exp(H)))`, which is equal to // `log(softmax(H)) = log(exp(H) / sum(exp(H)))` - let log_prob = &h - log_sum_exp(&h, Axis(1)).into_shape((h.nrows(), 1)).unwrap(); + let log_prob = &h + - log_sum_exp(&h, Axis(1)) + .into_shape_with_order((h.nrows(), 1)) + .unwrap(); (log_prob, params) } From f40cc2a1eb15619d393e0875b98e5a28754a6444 Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:13:41 +0100 Subject: [PATCH 13/28] Test argmin from repo --- algorithms/linfa-ftrl/Cargo.toml | 8 +++++--- algorithms/linfa-linear/Cargo.toml | 6 ++++-- algorithms/linfa-logistic/Cargo.toml | 8 +++++--- algorithms/linfa-logistic/src/lib.rs | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index daf95440c..df8db6fa2 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -25,9 +25,11 @@ features = ["derive"] [dependencies] ndarray = { version = "0.16", 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"] } +ndarray-rand = "0.15.0" +argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } +argmin-math = { version = "0.4", features = [ + "ndarray_v0_16-nolinalg", +], git = "https://github.com/argmin-rs/argmin.git" } thiserror = "1.0" rand = "0.8.5" rand_xoshiro = "0.6.0" diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 0421b49d9..cc67da050 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -33,8 +33,10 @@ ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" -argmin = { version = "0.9.0", default-features = false } -argmin-math = { version = "0.3", features = ["ndarray_v0_15-nolinalg"] } +argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } +argmin-math = { version = "0.4", features = [ + "ndarray_v0_16-nolinalg", +], git = "https://github.com/argmin-rs/argmin.git" } thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-logistic/Cargo.toml b/algorithms/linfa-logistic/Cargo.toml index edc679eaa..1939bfedd 100644 --- a/algorithms/linfa-logistic/Cargo.toml +++ b/algorithms/linfa-logistic/Cargo.toml @@ -24,10 +24,12 @@ version = "1.0" [dependencies] ndarray = { version = "0.16", features = ["approx"] } -ndarray-stats = "0.5.0" +ndarray-stats = "0.6.0" num-traits = "0.2" -argmin = { version = "0.9.0", default-features = false } -argmin-math = { version = "0.3", features = ["ndarray_v0_15-nolinalg"] } +argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } +argmin-math = { version = "0.4", features = [ + "ndarray_v0_16-nolinalg", +], git = "https://github.com/argmin-rs/argmin.git" } thiserror = "1.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-logistic/src/lib.rs b/algorithms/linfa-logistic/src/lib.rs index 49f068aca..558764cc9 100644 --- a/algorithms/linfa-logistic/src/lib.rs +++ b/algorithms/linfa-logistic/src/lib.rs @@ -110,7 +110,7 @@ type LBFGSType = LBFGS< type LBFGSType1 = LBFGSType; type LBFGSType2 = LBFGSType; -type IterStateType = IterState, ArgminParam, (), (), F>; +type IterStateType = IterState, ArgminParam, (), (), (), F>; impl LogisticRegressionValidParams { /// Create the initial parameters, either from a user supplied array From 60e75c3abcc2b6b0b9cc976b65f4301c99ed3a14 Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:23:28 +0100 Subject: [PATCH 14/28] Bump criterion version to "0.5.1" --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-trees/Cargo.toml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 61b8475ec..0cb2af90f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ sprs = { version = "0.11", default-features = false } thiserror = "1.0" -criterion = { version = "0.4.0", optional = true } +criterion = { version = "0.5.1", optional = true } [dependencies.serde_crate] package = "serde" diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 3d1684a52..684308fa1 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -54,7 +54,7 @@ ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "generate", ] } -criterion = "0.4.0" +criterion = "0.5.1" serde_json = "1" approx = "0.5" lax = "0.17.0" diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index df8db6fa2..645c88b6e 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -37,7 +37,7 @@ rand_xoshiro = "0.6.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -criterion = "0.4.0" +criterion = "0.5.1" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index d33da9be6..86bc39fc5 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -39,7 +39,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] ndarray-npy = { version = "0.9", default-features = false } paste = "1.0" -criterion = "0.4.0" +criterion = "0.5.1" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index cc67da050..eb5885eaa 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -46,7 +46,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } approx = "0.5" -criterion = "0.4.0" +criterion = "0.5.1" statrs = "0.16.0" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index bc3d2f245..3c11469f7 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -37,7 +37,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] approx = "0.5" -criterion = "0.4.0" +criterion = "0.5.1" rand_xoshiro = "0.6" ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 368a825a3..90ddcefb9 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -42,7 +42,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } approx = "0.5" rand_xoshiro = "0.6" -criterion = "0.4.0" +criterion = "0.5.1" statrs = "0.16.0" [[bench]] diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 8d642d06d..8294a74ae 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -53,7 +53,7 @@ curl = "0.4.35" flate2 = "1.0.20" tar = "0.4.33" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } -criterion = "0.4.0" +criterion = "0.5.1" statrs = "0.16.0" # FIXME: Disabled as dataset link is broken diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index b0907c339..9a1a8e31c 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -31,7 +31,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } -criterion = "0.4.0" +criterion = "0.5.1" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ "iris", From 59a75d1100c5e4097962d6e2205e011ee29fa264 Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:30:51 +0100 Subject: [PATCH 15/28] Bump statrs version to "0.18" --- Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- datasets/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0cb2af90f..06af6f902 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ linfa-datasets = { path = "datasets", features = [ "diabetes", "generate", ] } -statrs = "0.16.0" +statrs = "0.18" [target.'cfg(not(windows))'.dependencies] pprof = { version = "0.11.0", features = [ diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index eb5885eaa..96394b663 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -47,7 +47,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } approx = "0.5" criterion = "0.5.1" -statrs = "0.16.0" +statrs = "0.18" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 90ddcefb9..ab17049ad 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -43,7 +43,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ approx = "0.5" rand_xoshiro = "0.6" criterion = "0.5.1" -statrs = "0.16.0" +statrs = "0.18" [[bench]] name = "pls" diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 8294a74ae..f5f64d6f3 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -54,7 +54,7 @@ flate2 = "1.0.20" tar = "0.4.33" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } criterion = "0.5.1" -statrs = "0.16.0" +statrs = "0.18" # FIXME: Disabled as dataset link is broken # [[bench]] diff --git a/datasets/Cargo.toml b/datasets/Cargo.toml index 5ded9426f..92c3b4753 100644 --- a/datasets/Cargo.toml +++ b/datasets/Cargo.toml @@ -17,7 +17,7 @@ ndarray-rand = { version = "0.15", optional = true } [dev-dependencies] approx = "0.5" -statrs = "0.16.0" +statrs = "0.18" [features] default = [] From 07ff3f356dd311c1a2b8d3b4e232dec2517a3feb Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:34:05 +0100 Subject: [PATCH 16/28] Bump thiserror version to "2.0" --- Cargo.toml | 2 +- algorithms/linfa-bayes/Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-elasticnet/Cargo.toml | 2 +- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-logistic/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-reduction/Cargo.toml | 2 +- algorithms/linfa-svm/Cargo.toml | 2 +- algorithms/linfa-tsne/Cargo.toml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 06af6f902..4522a0ef9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } sprs = { version = "0.11", default-features = false } -thiserror = "1.0" +thiserror = "2.0" criterion = { version = "0.5.1", optional = true } diff --git a/algorithms/linfa-bayes/Cargo.toml b/algorithms/linfa-bayes/Cargo.toml index ae7e48654..e8c14ee90 100644 --- a/algorithms/linfa-bayes/Cargo.toml +++ b/algorithms/linfa-bayes/Cargo.toml @@ -23,7 +23,7 @@ features = ["std", "derive"] [dependencies] ndarray = { version = "0.16", features = ["approx"] } ndarray-stats = "0.6" -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 684308fa1..d8710c7e2 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -43,7 +43,7 @@ ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" space = "0.12" -thiserror = "1.0" +thiserror = "2.0" #partitions = "0.2.4" This one will break in a future version of Rust and has no replacement linfa = { version = "0.7.1", path = "../.." } linfa-nn = { version = "0.7.2", path = "../linfa-nn" } diff --git a/algorithms/linfa-elasticnet/Cargo.toml b/algorithms/linfa-elasticnet/Cargo.toml index aedf9fa7b..82a632c4e 100644 --- a/algorithms/linfa-elasticnet/Cargo.toml +++ b/algorithms/linfa-elasticnet/Cargo.toml @@ -35,7 +35,7 @@ ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" approx = "0.5" -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index 645c88b6e..c464a610d 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -30,7 +30,7 @@ argmin = { version = "0.10.0", default-features = false, git = "https://github.c argmin-math = { version = "0.4", features = [ "ndarray_v0_16-nolinalg", ], git = "https://github.com/argmin-rs/argmin.git" } -thiserror = "1.0" +thiserror = "2.0" rand = "0.8.5" rand_xoshiro = "0.6.0" diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 86bc39fc5..7a487b371 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -32,7 +32,7 @@ ndarray-rand = "0.15" ndarray-stats = "0.6" num-traits = "0.2" rand_xoshiro = "0.6" -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 96394b663..eee3520e7 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -37,7 +37,7 @@ argmin = { version = "0.10.0", default-features = false, git = "https://github.c argmin-math = { version = "0.4", features = [ "ndarray_v0_16-nolinalg", ], git = "https://github.com/argmin-rs/argmin.git" } -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-logistic/Cargo.toml b/algorithms/linfa-logistic/Cargo.toml index 1939bfedd..d2e155827 100644 --- a/algorithms/linfa-logistic/Cargo.toml +++ b/algorithms/linfa-logistic/Cargo.toml @@ -30,7 +30,7 @@ argmin = { version = "0.10.0", default-features = false, git = "https://github.c argmin-math = { version = "0.4", features = [ "ndarray_v0_16-nolinalg", ], git = "https://github.com/argmin-rs/argmin.git" } -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index 3c11469f7..e629780e3 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -29,7 +29,7 @@ ndarray-stats = "0.6" num-traits = "0.2.0" noisy_float = "0.2.0" order-stat = "0.1.3" -thiserror = "1.0" +thiserror = "2.0" kdtree = "0.7.0" diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index ab17049ad..0659f592e 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -32,7 +32,7 @@ ndarray-stats = "0.6" ndarray-rand = "0.15" num-traits = "0.2" paste = "1.0" -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index f5f64d6f3..b3cbecc61 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -23,7 +23,7 @@ ndarray = { version = "0.16", features = ["approx"] } ndarray-linalg = { version = "0.17", optional = true } linfa-linalg = { version = "0.2", default-features = false } ndarray-stats = "0.6" -thiserror = "1.0" +thiserror = "2.0" approx = "0.5" ndarray-rand = "0.15" unicode-normalization = "0.1.8" diff --git a/algorithms/linfa-reduction/Cargo.toml b/algorithms/linfa-reduction/Cargo.toml index c658a957c..782a59bdc 100644 --- a/algorithms/linfa-reduction/Cargo.toml +++ b/algorithms/linfa-reduction/Cargo.toml @@ -39,7 +39,7 @@ linfa-linalg = { version = "0.2" } ndarray-linalg = { version = "0.17", optional = true } ndarray-rand = "0.15" num-traits = "0.2" -thiserror = "1.0" +thiserror = "2.0" rand = { version = "0.8", features = ["small_rng"] } linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-svm/Cargo.toml b/algorithms/linfa-svm/Cargo.toml index d220cf9f0..881bb7b38 100644 --- a/algorithms/linfa-svm/Cargo.toml +++ b/algorithms/linfa-svm/Cargo.toml @@ -27,7 +27,7 @@ features = ["std", "derive"] ndarray = { version = "0.16" } ndarray-rand = "0.15" num-traits = "0.2" -thiserror = "1.0" +thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } linfa-kernel = { version = "0.7.1", path = "../linfa-kernel" } diff --git a/algorithms/linfa-tsne/Cargo.toml b/algorithms/linfa-tsne/Cargo.toml index 0d860d3c2..353b807bd 100644 --- a/algorithms/linfa-tsne/Cargo.toml +++ b/algorithms/linfa-tsne/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["tsne", "visualization", "clustering", "machine-learning", "linfa"] categories = ["algorithms", "mathematics", "science"] [dependencies] -thiserror = "1.0" +thiserror = "2.0" ndarray = { version = "0.16" } ndarray-rand = "0.15" bhtsne = "0.4.0" From 79297cf5bc65d40282d67757eecd3daee4288f7e Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:36:09 +0100 Subject: [PATCH 17/28] Use criterion version "0.5" instead of "0.5.1" --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- algorithms/linfa-trees/Cargo.toml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4522a0ef9..88525b2f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ sprs = { version = "0.11", default-features = false } thiserror = "2.0" -criterion = { version = "0.5.1", optional = true } +criterion = { version = "0.5", optional = true } [dependencies.serde_crate] package = "serde" diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index d8710c7e2..04f3f3582 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -54,7 +54,7 @@ ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "generate", ] } -criterion = "0.5.1" +criterion = "0.5" serde_json = "1" approx = "0.5" lax = "0.17.0" diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index c464a610d..173b72e8c 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -37,7 +37,7 @@ rand_xoshiro = "0.6.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -criterion = "0.5.1" +criterion = "0.5" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 7a487b371..9eb052b44 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -39,7 +39,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] ndarray-npy = { version = "0.9", default-features = false } paste = "1.0" -criterion = "0.5.1" +criterion = "0.5" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index eee3520e7..925bfcff3 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -46,7 +46,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } approx = "0.5" -criterion = "0.5.1" +criterion = "0.5" statrs = "0.18" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index e629780e3..dd5a03b1c 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -37,7 +37,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] approx = "0.5" -criterion = "0.5.1" +criterion = "0.5" rand_xoshiro = "0.6" ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 0659f592e..a2d0f6fd3 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -42,7 +42,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } approx = "0.5" rand_xoshiro = "0.6" -criterion = "0.5.1" +criterion = "0.5" statrs = "0.18" [[bench]] diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index b3cbecc61..8adae4fd9 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -53,7 +53,7 @@ curl = "0.4.35" flate2 = "1.0.20" tar = "0.4.33" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } -criterion = "0.5.1" +criterion = "0.5" statrs = "0.18" # FIXME: Disabled as dataset link is broken diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index 9a1a8e31c..3e0ebc470 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -31,7 +31,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } -criterion = "0.5.1" +criterion = "0.5" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ "iris", From 59b17dda8dc7fa062082ae5215b182a2379b9de5 Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 15:48:11 +0100 Subject: [PATCH 18/28] Bump pprof version to 0.14 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 88525b2f8..33acd61ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,7 @@ linfa-datasets = { path = "datasets", features = [ statrs = "0.18" [target.'cfg(not(windows))'.dependencies] -pprof = { version = "0.11.0", features = [ +pprof = { version = "0.14", features = [ "flamegraph", "criterion", ], optional = true } From f0afe72b9480d610a7bdb088455932c5f43b1fab Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 10 Mar 2025 16:38:38 +0100 Subject: [PATCH 19/28] Remove manual serde bound --- algorithms/linfa-logistic/src/hyperparams.rs | 6 ++---- algorithms/linfa-logistic/src/lib.rs | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/algorithms/linfa-logistic/src/hyperparams.rs b/algorithms/linfa-logistic/src/hyperparams.rs index a41bb82a0..32c072477 100644 --- a/algorithms/linfa-logistic/src/hyperparams.rs +++ b/algorithms/linfa-logistic/src/hyperparams.rs @@ -13,8 +13,7 @@ use serde_crate::{Deserialize, Serialize}; #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), - serde(crate = "serde_crate"), - serde(bound(deserialize = "D: Deserialize<'de>")) + serde(crate = "serde_crate") )] pub struct LogisticRegressionParams(LogisticRegressionValidParams); @@ -22,8 +21,7 @@ pub struct LogisticRegressionParams(LogisticRegressionVa #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), - serde(crate = "serde_crate"), - serde(bound(deserialize = "D: Deserialize<'de>")) + serde(crate = "serde_crate") )] pub struct LogisticRegressionValidParams { pub(crate) alpha: F, diff --git a/algorithms/linfa-logistic/src/lib.rs b/algorithms/linfa-logistic/src/lib.rs index 558764cc9..edc9f6c6d 100644 --- a/algorithms/linfa-logistic/src/lib.rs +++ b/algorithms/linfa-logistic/src/lib.rs @@ -574,8 +574,7 @@ fn multi_logistic_grad>( #[cfg_attr( feature = "serde", derive(Serialize, Deserialize), - serde(crate = "serde_crate"), - serde(bound(deserialize = "C: Deserialize<'de>")) + serde(crate = "serde_crate") )] pub struct FittedLogisticRegression { threshold: F, From 66820b8c01406d385fa2d914f7af2a0ecf1b20e7 Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 9 Jul 2025 09:57:18 +0200 Subject: [PATCH 20/28] Bump ndarray in linfa-ensemble --- algorithms/linfa-ensemble/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/algorithms/linfa-ensemble/Cargo.toml b/algorithms/linfa-ensemble/Cargo.toml index 0b2ce3453..50f3cb271 100644 --- a/algorithms/linfa-ensemble/Cargo.toml +++ b/algorithms/linfa-ensemble/Cargo.toml @@ -27,8 +27,8 @@ default-features = false features = ["std", "derive"] [dependencies] -ndarray = { version = "0.15", features = ["rayon", "approx"] } -ndarray-rand = "0.14" +ndarray = { version = "0.16", features = ["rayon", "approx"] } +ndarray-rand = "0.15" rand = "0.8.5" linfa = { version = "0.7.1", path = "../.." } From c1fbee7c54e806de3f5fb2c5240ce163d000f1ba Mon Sep 17 00:00:00 2001 From: relf Date: Wed, 9 Jul 2025 10:19:52 +0200 Subject: [PATCH 21/28] Linting --- algorithms/linfa-bayes/src/base_nb.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms/linfa-bayes/src/base_nb.rs b/algorithms/linfa-bayes/src/base_nb.rs index f0b87ce2f..da197d8a6 100644 --- a/algorithms/linfa-bayes/src/base_nb.rs +++ b/algorithms/linfa-bayes/src/base_nb.rs @@ -70,7 +70,7 @@ where .mapv(|x| x.exp()) .sum_axis(Axis(1)) .mapv(|x| x.ln()) - .into_shape((n_samples, 1)) + .into_shape_with_order((n_samples, 1)) .unwrap(); (log_prob_mat - log_prob_x, classes) From d9e7f1b4e1ff5a952cb1a9d320bfda778a8c4ab0 Mon Sep 17 00:00:00 2001 From: relf Date: Thu, 25 Sep 2025 18:08:06 +0200 Subject: [PATCH 22/28] Linting --- algorithms/linfa-bayes/src/lib.rs | 2 +- algorithms/linfa-linear/src/isotonic.rs | 3 +-- algorithms/linfa-logistic/src/lib.rs | 2 +- algorithms/linfa-nn/src/balltree.rs | 6 +++--- algorithms/linfa-nn/src/kdtree.rs | 4 ++-- algorithms/linfa-nn/src/lib.rs | 4 ++-- algorithms/linfa-nn/src/linear.rs | 4 ++-- algorithms/linfa-preprocessing/src/whitening.rs | 4 ++-- .../linfa-trees/src/decision_trees/algorithm.rs | 4 ++-- src/dataset/impl_dataset.rs | 4 ++-- src/dataset/impl_targets.rs | 10 +++++----- src/dataset/mod.rs | 14 +++++++------- src/metrics_regression.rs | 2 +- 13 files changed, 31 insertions(+), 32 deletions(-) diff --git a/algorithms/linfa-bayes/src/lib.rs b/algorithms/linfa-bayes/src/lib.rs index 273a1e955..ed2a67389 100644 --- a/algorithms/linfa-bayes/src/lib.rs +++ b/algorithms/linfa-bayes/src/lib.rs @@ -89,7 +89,7 @@ pub(crate) fn filter( let index = y .into_iter() .enumerate() - .filter(|&(_, y)| (*ycondition == *y)) + .filter(|&(_, y)| *ycondition == *y) .map(|(i, _)| i) .collect::>(); diff --git a/algorithms/linfa-linear/src/isotonic.rs b/algorithms/linfa-linear/src/isotonic.rs index 921d9153f..696e9dbec 100644 --- a/algorithms/linfa-linear/src/isotonic.rs +++ b/algorithms/linfa-linear/src/isotonic.rs @@ -265,8 +265,7 @@ impl> PredictInplace, Array1> y[i] = y_min; } else { let res = regressor.into_iter().position(|x| x >= &val); - if res.is_some() { - let j = res.unwrap(); + if let Some(j) = res { if val <= regressor[j] && j < n { let x_scale = (val - regressor[j - 1]) / (regressor[j] - regressor[j - 1]); y[i] = response[j - 1] + x_scale * (response[j] - response[j - 1]); diff --git a/algorithms/linfa-logistic/src/lib.rs b/algorithms/linfa-logistic/src/lib.rs index edc9f6c6d..1dad89688 100644 --- a/algorithms/linfa-logistic/src/lib.rs +++ b/algorithms/linfa-logistic/src/lib.rs @@ -393,7 +393,7 @@ where fn convert_params( n_features: usize, w: &Array, -) -> (ArrayView, CowArray) { +) -> (ArrayView<'_, F, D>, CowArray<'_, F, D::Smaller>) { let nrows = w.shape()[0]; if n_features == nrows { ( diff --git a/algorithms/linfa-nn/src/balltree.rs b/algorithms/linfa-nn/src/balltree.rs index 9174bbd1d..d9df4f261 100644 --- a/algorithms/linfa-nn/src/balltree.rs +++ b/algorithms/linfa-nn/src/balltree.rs @@ -201,7 +201,7 @@ impl<'a, F: Float, D: Distance> BallTreeIndex<'a, F, D> { point: Point<'_, F>, k: usize, max_radius: F, - ) -> Result, usize)>, NnError> { + ) -> Result, usize)>, NnError> { if self.dim != point.len() { Err(NnError::WrongDimension) } else if self.len == 0 { @@ -261,7 +261,7 @@ impl<'a, F: Float, D: Distance> BallTreeIndex<'a, F, D> { } impl> NearestNeighbourIndex for BallTreeIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { self.nn_helper(point, k, F::infinity()) } @@ -269,7 +269,7 @@ impl> NearestNeighbourIndex for BallTreeIndex<'_, F, &self, point: Point<'_, F>, range: F, - ) -> Result, usize)>, NnError> { + ) -> Result, usize)>, NnError> { let range = self.dist_fn.dist_to_rdist(range); self.nn_helper(point, self.len, range) } diff --git a/algorithms/linfa-nn/src/kdtree.rs b/algorithms/linfa-nn/src/kdtree.rs index 9cc328902..b90456550 100644 --- a/algorithms/linfa-nn/src/kdtree.rs +++ b/algorithms/linfa-nn/src/kdtree.rs @@ -51,7 +51,7 @@ impl From for NnError { } impl> NearestNeighbourIndex for KdTreeIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { Ok(self .0 .nearest( @@ -68,7 +68,7 @@ impl> NearestNeighbourIndex for KdTreeIndex<'_, F, D &self, point: Point<'_, F>, range: F, - ) -> Result, usize)>, NnError> { + ) -> Result, usize)>, NnError> { let range = self.1.dist_to_rdist(range); Ok(self .0 diff --git a/algorithms/linfa-nn/src/lib.rs b/algorithms/linfa-nn/src/lib.rs index 32cdd254b..e7df58666 100644 --- a/algorithms/linfa-nn/src/lib.rs +++ b/algorithms/linfa-nn/src/lib.rs @@ -98,7 +98,7 @@ pub trait NearestNeighbourIndex: Send + Sync + Unpin { /// /// Returns an error if the provided point has different dimensionality than the index's /// points. - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError>; + fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError>; /// Returns all the points in the index that are within the specified distance to the provided /// point, along with their positions in the original dataset. The points are not guaranteed to @@ -110,7 +110,7 @@ pub trait NearestNeighbourIndex: Send + Sync + Unpin { &self, point: Point<'_, F>, range: F, - ) -> Result, usize)>, NnError>; + ) -> Result, usize)>, NnError>; } /// Enum that dispatches to one of the crate's [`NearestNeighbour`] diff --git a/algorithms/linfa-nn/src/linear.rs b/algorithms/linfa-nn/src/linear.rs index f59fdcced..94e4fcf1c 100644 --- a/algorithms/linfa-nn/src/linear.rs +++ b/algorithms/linfa-nn/src/linear.rs @@ -30,7 +30,7 @@ impl<'a, F: Float, D: Distance> LinearSearchIndex<'a, F, D> { } impl> NearestNeighbourIndex for LinearSearchIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { if self.0.ncols() != point.len() { Err(NnError::WrongDimension) } else { @@ -53,7 +53,7 @@ impl> NearestNeighbourIndex for LinearSearchIndex<'_ &self, point: Point<'_, F>, range: F, - ) -> Result, usize)>, NnError> { + ) -> Result, usize)>, NnError> { if self.0.ncols() != point.len() { Err(NnError::WrongDimension) } else { diff --git a/algorithms/linfa-preprocessing/src/whitening.rs b/algorithms/linfa-preprocessing/src/whitening.rs index 178127dde..7e0dfd2a6 100644 --- a/algorithms/linfa-preprocessing/src/whitening.rs +++ b/algorithms/linfa-preprocessing/src/whitening.rs @@ -188,12 +188,12 @@ pub struct FittedWhitener { impl FittedWhitener { /// The matrix used for scaling the data - pub fn transformation_matrix(&self) -> ArrayView2 { + pub fn transformation_matrix(&self) -> ArrayView2<'_, F> { self.transformation_matrix.view() } /// The means that will be subtracted to the features before scaling the data - pub fn mean(&self) -> ArrayView1 { + pub fn mean(&self) -> ArrayView1<'_, F> { self.mean.view() } } diff --git a/algorithms/linfa-trees/src/decision_trees/algorithm.rs b/algorithms/linfa-trees/src/decision_trees/algorithm.rs index 4ce54ebba..c507b0845 100644 --- a/algorithms/linfa-trees/src/decision_trees/algorithm.rs +++ b/algorithms/linfa-trees/src/decision_trees/algorithm.rs @@ -549,7 +549,7 @@ where impl DecisionTree { /// Create a node iterator in level-order (BFT) - pub fn iter_nodes(&self) -> NodeIter { + pub fn iter_nodes(&self) -> NodeIter<'_, F, L> { // queue of nodes yet to explore let queue = vec![&self.root_node]; @@ -627,7 +627,7 @@ impl DecisionTree { /// * `legend=false` /// * `complete=true` /// - pub fn export_to_tikz(&self) -> Tikz { + pub fn export_to_tikz(&self) -> Tikz<'_, F, L> { Tikz::new(self) } } diff --git a/src/dataset/impl_dataset.rs b/src/dataset/impl_dataset.rs index 4559d362c..dce5dcc2d 100644 --- a/src/dataset/impl_dataset.rs +++ b/src/dataset/impl_dataset.rs @@ -273,7 +273,7 @@ impl> AsTargets for DatasetBase { type Elem = L; type Ix = T::Ix; - fn as_targets(&self) -> ArrayView { + fn as_targets(&self) -> ArrayView<'_, Self::Elem, Self::Ix> { self.targets.as_targets() } } @@ -282,7 +282,7 @@ impl> AsTargetsMut for DatasetBase ArrayViewMut { + fn as_targets_mut(&mut self) -> ArrayViewMut<'_, Self::Elem, Self::Ix> { self.targets.as_targets_mut() } } diff --git a/src/dataset/impl_targets.rs b/src/dataset/impl_targets.rs index e732c250e..95fd5bf08 100644 --- a/src/dataset/impl_targets.rs +++ b/src/dataset/impl_targets.rs @@ -17,7 +17,7 @@ impl, I: TargetDim> AsTargets for ArrayBase { type Elem = L; type Ix = I; - fn as_targets(&self) -> ArrayView { + fn as_targets(&self) -> ArrayView<'_, L, I> { self.view() } } @@ -47,7 +47,7 @@ impl, I: TargetDim> AsTargetsMut for ArrayBase { type Elem = L; type Ix = I; - fn as_targets_mut(&mut self) -> ArrayViewMut { + fn as_targets_mut(&mut self) -> ArrayViewMut<'_, Self::Elem, I> { self.view_mut() } } @@ -59,7 +59,7 @@ impl AsTargets for &T { type Elem = T::Elem; type Ix = T::Ix; - fn as_targets(&self) -> ArrayView { + fn as_targets(&self) -> ArrayView<'_, Self::Elem, Self::Ix> { (*self).as_targets() } } @@ -68,7 +68,7 @@ impl> AsTargets for CountedTargets { type Elem = L; type Ix = T::Ix; - fn as_targets(&self) -> ArrayView { + fn as_targets(&self) -> ArrayView<'_, Self::Elem, Self::Ix> { self.targets.as_targets() } } @@ -77,7 +77,7 @@ impl> AsTargetsMut for CountedTargets type Elem = L; type Ix = T::Ix; - fn as_targets_mut(&mut self) -> ArrayViewMut { + fn as_targets_mut(&mut self) -> ArrayViewMut<'_, Self::Elem, Self::Ix> { self.targets.as_targets_mut() } } diff --git a/src/dataset/mod.rs b/src/dataset/mod.rs index 9ab3c2a5a..188fe8c1e 100644 --- a/src/dataset/mod.rs +++ b/src/dataset/mod.rs @@ -245,19 +245,19 @@ pub trait AsTargets { type Elem; type Ix: TargetDim; - fn as_targets(&self) -> ArrayView; + fn as_targets(&self) -> ArrayView<'_, Self::Elem, Self::Ix>; } /// Return a reference to single-target variables. pub trait AsSingleTargets: AsTargets { - fn as_single_targets(&self) -> ArrayView1 { + fn as_single_targets(&self) -> ArrayView1<'_, Self::Elem> { self.as_targets() } } /// Return a reference to multi-target variables. pub trait AsMultiTargets: AsTargets { - fn as_multi_targets(&self) -> ArrayView2 { + fn as_multi_targets(&self) -> ArrayView2<'_, Self::Elem> { self.as_targets() } } @@ -289,19 +289,19 @@ pub trait AsTargetsMut { type Elem; type Ix: TargetDim; - fn as_targets_mut(&mut self) -> ArrayViewMut; + fn as_targets_mut(&mut self) -> ArrayViewMut<'_, Self::Elem, Self::Ix>; } /// Returns a mutable reference to single-target variables. pub trait AsSingleTargetsMut: AsTargetsMut { - fn as_single_targets_mut(&mut self) -> ArrayViewMut1 { + fn as_single_targets_mut(&mut self) -> ArrayViewMut1<'_, Self::Elem> { self.as_targets_mut() } } /// Returns a mutable reference to multi-target variables. pub trait AsMultiTargetsMut: AsTargetsMut { - fn as_multi_targets_mut(&mut self) -> ArrayViewMut2 { + fn as_multi_targets_mut(&mut self) -> ArrayViewMut2<'_, Self::Elem> { self.as_targets_mut() } } @@ -311,7 +311,7 @@ pub trait AsMultiTargetsMut: AsTargetsMut { /// Some algorithms are working with probabilities. Targets which allow an implicit conversion into /// probabilities can implement this trait. pub trait AsProbabilities { - fn as_multi_target_probabilities(&self) -> CowArray; + fn as_multi_target_probabilities(&self) -> CowArray<'_, Pr, Ix3>; } /// Get the labels in all targets diff --git a/src/metrics_regression.rs b/src/metrics_regression.rs index eed90900d..56508cd6a 100644 --- a/src/metrics_regression.rs +++ b/src/metrics_regression.rs @@ -62,7 +62,7 @@ pub trait SingleTargetRegression>: .to_vec(); abs_error.sort_by(|a, b| a.partial_cmp(b).unwrap()); let mid = abs_error.len() / 2; - if abs_error.len() % 2 == 0 { + if abs_error.len().is_multiple_of(2) { Ok((abs_error[mid - 1] + abs_error[mid]) / F::cast(2.0)) } else { Ok(abs_error[mid]) From c89f1319c3f2006f0ec9983f058bd48e054ae4b2 Mon Sep 17 00:00:00 2001 From: relf Date: Thu, 25 Sep 2025 18:11:25 +0200 Subject: [PATCH 23/28] Format --- algorithms/linfa-nn/src/balltree.rs | 6 +++++- algorithms/linfa-nn/src/kdtree.rs | 6 +++++- algorithms/linfa-nn/src/lib.rs | 6 +++++- algorithms/linfa-nn/src/linear.rs | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/algorithms/linfa-nn/src/balltree.rs b/algorithms/linfa-nn/src/balltree.rs index d9df4f261..ca39e9f85 100644 --- a/algorithms/linfa-nn/src/balltree.rs +++ b/algorithms/linfa-nn/src/balltree.rs @@ -261,7 +261,11 @@ impl<'a, F: Float, D: Distance> BallTreeIndex<'a, F, D> { } impl> NearestNeighbourIndex for BallTreeIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest( + &self, + point: Point<'_, F>, + k: usize, + ) -> Result, usize)>, NnError> { self.nn_helper(point, k, F::infinity()) } diff --git a/algorithms/linfa-nn/src/kdtree.rs b/algorithms/linfa-nn/src/kdtree.rs index b90456550..d8cbe9910 100644 --- a/algorithms/linfa-nn/src/kdtree.rs +++ b/algorithms/linfa-nn/src/kdtree.rs @@ -51,7 +51,11 @@ impl From for NnError { } impl> NearestNeighbourIndex for KdTreeIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest( + &self, + point: Point<'_, F>, + k: usize, + ) -> Result, usize)>, NnError> { Ok(self .0 .nearest( diff --git a/algorithms/linfa-nn/src/lib.rs b/algorithms/linfa-nn/src/lib.rs index e7df58666..598e265c3 100644 --- a/algorithms/linfa-nn/src/lib.rs +++ b/algorithms/linfa-nn/src/lib.rs @@ -98,7 +98,11 @@ pub trait NearestNeighbourIndex: Send + Sync + Unpin { /// /// Returns an error if the provided point has different dimensionality than the index's /// points. - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError>; + fn k_nearest( + &self, + point: Point<'_, F>, + k: usize, + ) -> Result, usize)>, NnError>; /// Returns all the points in the index that are within the specified distance to the provided /// point, along with their positions in the original dataset. The points are not guaranteed to diff --git a/algorithms/linfa-nn/src/linear.rs b/algorithms/linfa-nn/src/linear.rs index 94e4fcf1c..1b8851f99 100644 --- a/algorithms/linfa-nn/src/linear.rs +++ b/algorithms/linfa-nn/src/linear.rs @@ -30,7 +30,11 @@ impl<'a, F: Float, D: Distance> LinearSearchIndex<'a, F, D> { } impl> NearestNeighbourIndex for LinearSearchIndex<'_, F, D> { - fn k_nearest(&self, point: Point<'_, F>, k: usize) -> Result, usize)>, NnError> { + fn k_nearest( + &self, + point: Point<'_, F>, + k: usize, + ) -> Result, usize)>, NnError> { if self.0.ncols() != point.len() { Err(NnError::WrongDimension) } else { From 4c52c1c2444596780cb622aa5e14a79fcc7d76c4 Mon Sep 17 00:00:00 2001 From: relf Date: Thu, 25 Sep 2025 18:17:20 +0200 Subject: [PATCH 24/28] Bump MSRV to 1.87.0 (due to is_multiple_of lint) --- .github/workflows/checking.yml | 2 +- .github/workflows/testing.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checking.yml b/.github/workflows/checking.yml index 001be4382..7e807b084 100644 --- a/.github/workflows/checking.yml +++ b/.github/workflows/checking.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.82.0 + - 1.87.0 - stable - nightly os: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 45b633773..43b4291ae 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.82.0 + - 1.87.0 - stable os: - ubuntu-latest @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.82.0 + - 1.87.0 - stable os: - ubuntu-latest From 12987a3bc2556d9d85c32f50b22f36dbf3746383 Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 29 Sep 2025 15:34:18 +0200 Subject: [PATCH 25/28] Bump argmin version to 0.11 (argmin-math 0.5) --- algorithms/linfa-ftrl/Cargo.toml | 6 ++---- algorithms/linfa-linear/Cargo.toml | 6 ++---- algorithms/linfa-logistic/Cargo.toml | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index 173b72e8c..2f842bdde 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -26,10 +26,8 @@ features = ["derive"] [dependencies] ndarray = { version = "0.16", features = ["serde"] } ndarray-rand = "0.15.0" -argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } -argmin-math = { version = "0.4", features = [ - "ndarray_v0_16-nolinalg", -], git = "https://github.com/argmin-rs/argmin.git" } +argmin = { version = "0.11.0", default-features = false } +argmin-math = { version = "0.5", features = ["ndarray_v0_16-nolinalg"] } thiserror = "2.0" rand = "0.8.5" rand_xoshiro = "0.6.0" diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 925bfcff3..340d9ab7f 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -33,10 +33,8 @@ ndarray = { version = "0.16", features = ["approx"] } linfa-linalg = { version = "0.2", default-features = false } ndarray-linalg = { version = "0.17", optional = true } num-traits = "0.2" -argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } -argmin-math = { version = "0.4", features = [ - "ndarray_v0_16-nolinalg", -], git = "https://github.com/argmin-rs/argmin.git" } +argmin = { version = "0.11.0", default-features = false } +argmin-math = { version = "0.5", features = ["ndarray_v0_16-nolinalg"] } thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } diff --git a/algorithms/linfa-logistic/Cargo.toml b/algorithms/linfa-logistic/Cargo.toml index d2e155827..c39c78b71 100644 --- a/algorithms/linfa-logistic/Cargo.toml +++ b/algorithms/linfa-logistic/Cargo.toml @@ -26,10 +26,8 @@ version = "1.0" ndarray = { version = "0.16", features = ["approx"] } ndarray-stats = "0.6.0" num-traits = "0.2" -argmin = { version = "0.10.0", default-features = false, git = "https://github.com/argmin-rs/argmin.git" } -argmin-math = { version = "0.4", features = [ - "ndarray_v0_16-nolinalg", -], git = "https://github.com/argmin-rs/argmin.git" } +argmin = { version = "0.11.0", default-features = false } +argmin-math = { version = "0.5", features = ["ndarray_v0_16-nolinalg"] } thiserror = "2.0" linfa = { version = "0.7.1", path = "../.." } From a5780a61384c0e033508076ebe647bb5a4ad54cd Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 29 Sep 2025 15:46:11 +0200 Subject: [PATCH 26/28] Bump criterion to version 0.7 --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-clustering/benches/dbscan.rs | 5 +- .../benches/gaussian_mixture.rs | 5 +- .../linfa-clustering/benches/k_means.rs | 46 +++++++++++-------- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-ftrl/benches/ftrl.rs | 13 ++++-- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- .../benches/linear_scaler_bench.rs | 6 +-- .../benches/norm_scaler_bench.rs | 4 +- .../benches/vectorizer_bench.rs | 10 ++-- .../benches/whitening_bench.rs | 6 +-- algorithms/linfa-trees/Cargo.toml | 2 +- 17 files changed, 61 insertions(+), 52 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 33acd61ea..07b0c179b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ sprs = { version = "0.11", default-features = false } thiserror = "2.0" -criterion = { version = "0.5", optional = true } +criterion = { version = "0.7", optional = true } [dependencies.serde_crate] package = "serde" diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 04f3f3582..90eeed5bc 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -54,7 +54,7 @@ ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "generate", ] } -criterion = "0.5" +criterion = "0.7" serde_json = "1" approx = "0.5" lax = "0.17.0" diff --git a/algorithms/linfa-clustering/benches/dbscan.rs b/algorithms/linfa-clustering/benches/dbscan.rs index b8b1314eb..2c69f51fe 100644 --- a/algorithms/linfa-clustering/benches/dbscan.rs +++ b/algorithms/linfa-clustering/benches/dbscan.rs @@ -1,6 +1,5 @@ use criterion::{ - black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, - PlotConfiguration, + criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, }; use linfa::benchmarks::config; use linfa::prelude::{ParamGuard, Transformer}; @@ -34,7 +33,7 @@ fn dbscan_bench(c: &mut Criterion) { let dataset = generate::blobs(cluster_size, ¢roids, rng); bencher.iter(|| { - black_box( + std::hint::black_box( Dbscan::params(min_points) .tolerance(tolerance) .check_unwrap() diff --git a/algorithms/linfa-clustering/benches/gaussian_mixture.rs b/algorithms/linfa-clustering/benches/gaussian_mixture.rs index d2d0dacb9..3552e6e60 100644 --- a/algorithms/linfa-clustering/benches/gaussian_mixture.rs +++ b/algorithms/linfa-clustering/benches/gaussian_mixture.rs @@ -1,6 +1,5 @@ use criterion::{ - black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, - PlotConfiguration, + criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, }; use linfa::benchmarks::config; use linfa::traits::Fit; @@ -34,7 +33,7 @@ fn gaussian_mixture_bench(c: &mut Criterion) { let dataset: DatasetBase<_, _> = (generate::blobs(cluster_size, ¢roids, rng)).into(); bencher.iter(|| { - black_box( + std::hint::black_box( GaussianMixtureModel::params(n_clusters) .with_rng(rng.clone()) .tolerance(1e-3) diff --git a/algorithms/linfa-clustering/benches/k_means.rs b/algorithms/linfa-clustering/benches/k_means.rs index b72982917..6b29e580a 100644 --- a/algorithms/linfa-clustering/benches/k_means.rs +++ b/algorithms/linfa-clustering/benches/k_means.rs @@ -1,5 +1,5 @@ use criterion::{ - black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, + criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, }; use linfa::benchmarks::config; @@ -53,12 +53,15 @@ fn k_means_bench(c: &mut Criterion) { BenchmarkId::new("naive_k_means", format!("{n_clusters}x{cluster_size}")), |bencher| { bencher.iter(|| { - let m = KMeans::params_with_rng(black_box(n_clusters), black_box(rng.clone())) - .init_method(KMeansInit::KMeansPlusPlus) - .max_n_iterations(black_box(1000)) - .tolerance(black_box(1e-3)) - .fit(&dataset) - .unwrap(); + let m = KMeans::params_with_rng( + std::hint::black_box(n_clusters), + std::hint::black_box(rng.clone()), + ) + .init_method(KMeansInit::KMeansPlusPlus) + .max_n_iterations(std::hint::black_box(1000)) + .tolerance(std::hint::black_box(1e-3)) + .fit(&dataset) + .unwrap(); stats.add(m.inertia()); }); }, @@ -92,12 +95,14 @@ fn k_means_incr_bench(c: &mut Criterion) { ), |bencher| { bencher.iter(|| { - let clf = - KMeans::params_with_rng(black_box(n_clusters), black_box(rng.clone())) - .init_method(KMeansInit::KMeansPlusPlus) - .tolerance(black_box(1e-3)) - .check() - .unwrap(); + let clf = KMeans::params_with_rng( + std::hint::black_box(n_clusters), + std::hint::black_box(rng.clone()), + ) + .init_method(KMeansInit::KMeansPlusPlus) + .tolerance(std::hint::black_box(1e-3)) + .check() + .unwrap(); let model = dataset .sample_chunks(200) .cycle() @@ -146,13 +151,14 @@ fn k_means_init_bench(c: &mut Criterion) { bencher.iter(|| { // Do 1 run of KMeans with 1 iterations, so it's mostly just the init // algorithm - let m = KMeans::params_with_rng(black_box(n_clusters), rng.clone()) - .init_method(init.clone()) - .max_n_iterations(1) - .n_runs(1) - .tolerance(1000.0) // Guaranteed convergence - .fit(&dataset) - .unwrap(); + let m = + KMeans::params_with_rng(std::hint::black_box(n_clusters), rng.clone()) + .init_method(init.clone()) + .max_n_iterations(1) + .n_runs(1) + .tolerance(1000.0) // Guaranteed convergence + .fit(&dataset) + .unwrap(); stats.add(m.inertia()); }); }, diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index 2f842bdde..3d58e3940 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -35,7 +35,7 @@ rand_xoshiro = "0.6.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -criterion = "0.5" +criterion = "0.7" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", diff --git a/algorithms/linfa-ftrl/benches/ftrl.rs b/algorithms/linfa-ftrl/benches/ftrl.rs index 48bd66992..f5624f3b1 100644 --- a/algorithms/linfa-ftrl/benches/ftrl.rs +++ b/algorithms/linfa-ftrl/benches/ftrl.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::prelude::Predict; use linfa::traits::FitWith; @@ -24,7 +24,9 @@ fn fit_without_prior_model(c: &mut Criterion) { BenchmarkId::new("training on ", format!("dataset {nfeatures}x{nrows}")), |bencher| { bencher.iter(|| { - params.fit_with(None, black_box(&dataset)).unwrap(); + params + .fit_with(None, std::hint::black_box(&dataset)) + .unwrap(); }); }, ); @@ -50,7 +52,10 @@ fn fit_with_prior_model(c: &mut Criterion) { |bencher| { bencher.iter(|| { let _ = params - .fit_with(black_box(Some(model.clone())), black_box(&dataset)) + .fit_with( + std::hint::black_box(Some(model.clone())), + std::hint::black_box(&dataset), + ) .unwrap(); }); }, @@ -75,7 +80,7 @@ fn predict(c: &mut Criterion) { BenchmarkId::new("predicting on ", format!("dataset {nfeatures}x{nrows}")), |bencher| { bencher.iter(|| { - model.predict(black_box(&dataset)); + model.predict(std::hint::black_box(&dataset)); }); }, ); diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 9eb052b44..3d0299dc7 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -39,7 +39,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] ndarray-npy = { version = "0.9", default-features = false } paste = "1.0" -criterion = "0.5" +criterion = "0.7" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index 340d9ab7f..d98378ed9 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -44,7 +44,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } approx = "0.5" -criterion = "0.5" +criterion = "0.7" statrs = "0.18" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index dd5a03b1c..ff26ae333 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -37,7 +37,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] approx = "0.5" -criterion = "0.5" +criterion = "0.7" rand_xoshiro = "0.6" ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index a2d0f6fd3..15a6be23e 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -42,7 +42,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } approx = "0.5" rand_xoshiro = "0.6" -criterion = "0.5" +criterion = "0.7" statrs = "0.18" [[bench]] diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index 8adae4fd9..c429a60d1 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -53,7 +53,7 @@ curl = "0.4.35" flate2 = "1.0.20" tar = "0.4.33" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } -criterion = "0.5" +criterion = "0.7" statrs = "0.18" # FIXME: Disabled as dataset link is broken diff --git a/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs b/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs index 9eaabd045..5a9960050 100644 --- a/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs +++ b/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::{Fit, Transformer}; use linfa_datasets::generate::make_dataset; @@ -24,9 +24,9 @@ fn bench(c: &mut Criterion) { |bencher| { bencher.iter(|| { liner_scaler - .fit(black_box(&dataset)) + .fit(std::hint::black_box(&dataset)) .unwrap() - .transform(black_box(dataset.view())); + .transform(std::hint::black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs b/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs index f0cb9ae81..26d8bedac 100644 --- a/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs +++ b/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::Transformer; use linfa_datasets::generate::make_dataset; @@ -23,7 +23,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new(fn_name, format!("{nfeatures}x{size}")), |bencher| { bencher.iter(|| { - scaler.transform(black_box(dataset.view())); + scaler.transform(std::hint::black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs b/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs index 91c821f81..dd85d16e4 100644 --- a/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs +++ b/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs @@ -5,7 +5,7 @@ use linfa_preprocessing::CountVectorizer; use std::path::Path; use tar::Archive; -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; fn download_20news_bydate() { @@ -149,14 +149,14 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Vectorizer", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_vectorizer(black_box(&file_names)); + fit_vectorizer(std::hint::black_box(&file_names)); }); }, ); benchmark.bench_function(BenchmarkId::new("Fit-Tf-Idf", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_tf_idf(black_box(&file_names)); + fit_tf_idf(std::hint::black_box(&file_names)); }); }); @@ -164,7 +164,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Transfor-Vectorizer", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_transform_vectorizer(black_box(&file_names)); + fit_transform_vectorizer(std::hint::black_box(&file_names)); }); }, ); @@ -173,7 +173,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Transfor-Tf-Idf", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_transform_tf_idf(black_box(&file_names)); + fit_transform_tf_idf(std::hint::black_box(&file_names)); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/whitening_bench.rs b/algorithms/linfa-preprocessing/benches/whitening_bench.rs index 6ec6b27fa..94fa1b3c7 100644 --- a/algorithms/linfa-preprocessing/benches/whitening_bench.rs +++ b/algorithms/linfa-preprocessing/benches/whitening_bench.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::Fit; use linfa::traits::Transformer; @@ -25,9 +25,9 @@ fn bench(c: &mut Criterion) { |bencher| { bencher.iter(|| { whitener - .fit(black_box(&dataset)) + .fit(std::hint::black_box(&dataset)) .unwrap() - .transform(black_box(dataset.view())); + .transform(std::hint::black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index 3e0ebc470..95129df95 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -31,7 +31,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } -criterion = "0.5" +criterion = "0.7" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ "iris", From 0ccc47699818a0e8f5bc08ba350f330e999e4acc Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 29 Sep 2025 16:31:26 +0200 Subject: [PATCH 27/28] Format --- algorithms/linfa-clustering/benches/k_means.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/algorithms/linfa-clustering/benches/k_means.rs b/algorithms/linfa-clustering/benches/k_means.rs index 6b29e580a..b7ae54b26 100644 --- a/algorithms/linfa-clustering/benches/k_means.rs +++ b/algorithms/linfa-clustering/benches/k_means.rs @@ -1,6 +1,5 @@ use criterion::{ - criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, - PlotConfiguration, + criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, }; use linfa::benchmarks::config; use linfa::prelude::*; From 493732f8d9a24e337d1d40a047622760acfad92e Mon Sep 17 00:00:00 2001 From: relf Date: Mon, 29 Sep 2025 16:48:32 +0200 Subject: [PATCH 28/28] Revert "Bump criterion to version 0.7" --- Cargo.toml | 2 +- algorithms/linfa-clustering/Cargo.toml | 2 +- algorithms/linfa-clustering/benches/dbscan.rs | 5 +- .../benches/gaussian_mixture.rs | 5 +- .../linfa-clustering/benches/k_means.rs | 47 +++++++++---------- algorithms/linfa-ftrl/Cargo.toml | 2 +- algorithms/linfa-ftrl/benches/ftrl.rs | 13 ++--- algorithms/linfa-ica/Cargo.toml | 2 +- algorithms/linfa-linear/Cargo.toml | 2 +- algorithms/linfa-nn/Cargo.toml | 2 +- algorithms/linfa-pls/Cargo.toml | 2 +- algorithms/linfa-preprocessing/Cargo.toml | 2 +- .../benches/linear_scaler_bench.rs | 6 +-- .../benches/norm_scaler_bench.rs | 4 +- .../benches/vectorizer_bench.rs | 10 ++-- .../benches/whitening_bench.rs | 6 +-- algorithms/linfa-trees/Cargo.toml | 2 +- 17 files changed, 53 insertions(+), 61 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 07b0c179b..33acd61ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ sprs = { version = "0.11", default-features = false } thiserror = "2.0" -criterion = { version = "0.7", optional = true } +criterion = { version = "0.5", optional = true } [dependencies.serde_crate] package = "serde" diff --git a/algorithms/linfa-clustering/Cargo.toml b/algorithms/linfa-clustering/Cargo.toml index 90eeed5bc..04f3f3582 100644 --- a/algorithms/linfa-clustering/Cargo.toml +++ b/algorithms/linfa-clustering/Cargo.toml @@ -54,7 +54,7 @@ ndarray-npy = { version = "0.9", default-features = false } linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "generate", ] } -criterion = "0.7" +criterion = "0.5" serde_json = "1" approx = "0.5" lax = "0.17.0" diff --git a/algorithms/linfa-clustering/benches/dbscan.rs b/algorithms/linfa-clustering/benches/dbscan.rs index 2c69f51fe..b8b1314eb 100644 --- a/algorithms/linfa-clustering/benches/dbscan.rs +++ b/algorithms/linfa-clustering/benches/dbscan.rs @@ -1,5 +1,6 @@ use criterion::{ - criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, + black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, + PlotConfiguration, }; use linfa::benchmarks::config; use linfa::prelude::{ParamGuard, Transformer}; @@ -33,7 +34,7 @@ fn dbscan_bench(c: &mut Criterion) { let dataset = generate::blobs(cluster_size, ¢roids, rng); bencher.iter(|| { - std::hint::black_box( + black_box( Dbscan::params(min_points) .tolerance(tolerance) .check_unwrap() diff --git a/algorithms/linfa-clustering/benches/gaussian_mixture.rs b/algorithms/linfa-clustering/benches/gaussian_mixture.rs index 3552e6e60..d2d0dacb9 100644 --- a/algorithms/linfa-clustering/benches/gaussian_mixture.rs +++ b/algorithms/linfa-clustering/benches/gaussian_mixture.rs @@ -1,5 +1,6 @@ use criterion::{ - criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, + black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, + PlotConfiguration, }; use linfa::benchmarks::config; use linfa::traits::Fit; @@ -33,7 +34,7 @@ fn gaussian_mixture_bench(c: &mut Criterion) { let dataset: DatasetBase<_, _> = (generate::blobs(cluster_size, ¢roids, rng)).into(); bencher.iter(|| { - std::hint::black_box( + black_box( GaussianMixtureModel::params(n_clusters) .with_rng(rng.clone()) .tolerance(1e-3) diff --git a/algorithms/linfa-clustering/benches/k_means.rs b/algorithms/linfa-clustering/benches/k_means.rs index b7ae54b26..b72982917 100644 --- a/algorithms/linfa-clustering/benches/k_means.rs +++ b/algorithms/linfa-clustering/benches/k_means.rs @@ -1,5 +1,6 @@ use criterion::{ - criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, + black_box, criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, + PlotConfiguration, }; use linfa::benchmarks::config; use linfa::prelude::*; @@ -52,15 +53,12 @@ fn k_means_bench(c: &mut Criterion) { BenchmarkId::new("naive_k_means", format!("{n_clusters}x{cluster_size}")), |bencher| { bencher.iter(|| { - let m = KMeans::params_with_rng( - std::hint::black_box(n_clusters), - std::hint::black_box(rng.clone()), - ) - .init_method(KMeansInit::KMeansPlusPlus) - .max_n_iterations(std::hint::black_box(1000)) - .tolerance(std::hint::black_box(1e-3)) - .fit(&dataset) - .unwrap(); + let m = KMeans::params_with_rng(black_box(n_clusters), black_box(rng.clone())) + .init_method(KMeansInit::KMeansPlusPlus) + .max_n_iterations(black_box(1000)) + .tolerance(black_box(1e-3)) + .fit(&dataset) + .unwrap(); stats.add(m.inertia()); }); }, @@ -94,14 +92,12 @@ fn k_means_incr_bench(c: &mut Criterion) { ), |bencher| { bencher.iter(|| { - let clf = KMeans::params_with_rng( - std::hint::black_box(n_clusters), - std::hint::black_box(rng.clone()), - ) - .init_method(KMeansInit::KMeansPlusPlus) - .tolerance(std::hint::black_box(1e-3)) - .check() - .unwrap(); + let clf = + KMeans::params_with_rng(black_box(n_clusters), black_box(rng.clone())) + .init_method(KMeansInit::KMeansPlusPlus) + .tolerance(black_box(1e-3)) + .check() + .unwrap(); let model = dataset .sample_chunks(200) .cycle() @@ -150,14 +146,13 @@ fn k_means_init_bench(c: &mut Criterion) { bencher.iter(|| { // Do 1 run of KMeans with 1 iterations, so it's mostly just the init // algorithm - let m = - KMeans::params_with_rng(std::hint::black_box(n_clusters), rng.clone()) - .init_method(init.clone()) - .max_n_iterations(1) - .n_runs(1) - .tolerance(1000.0) // Guaranteed convergence - .fit(&dataset) - .unwrap(); + let m = KMeans::params_with_rng(black_box(n_clusters), rng.clone()) + .init_method(init.clone()) + .max_n_iterations(1) + .n_runs(1) + .tolerance(1000.0) // Guaranteed convergence + .fit(&dataset) + .unwrap(); stats.add(m.inertia()); }); }, diff --git a/algorithms/linfa-ftrl/Cargo.toml b/algorithms/linfa-ftrl/Cargo.toml index 3d58e3940..2f842bdde 100644 --- a/algorithms/linfa-ftrl/Cargo.toml +++ b/algorithms/linfa-ftrl/Cargo.toml @@ -35,7 +35,7 @@ rand_xoshiro = "0.6.0" linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] -criterion = "0.7" +criterion = "0.5" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "winequality", diff --git a/algorithms/linfa-ftrl/benches/ftrl.rs b/algorithms/linfa-ftrl/benches/ftrl.rs index f5624f3b1..48bd66992 100644 --- a/algorithms/linfa-ftrl/benches/ftrl.rs +++ b/algorithms/linfa-ftrl/benches/ftrl.rs @@ -1,4 +1,4 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::prelude::Predict; use linfa::traits::FitWith; @@ -24,9 +24,7 @@ fn fit_without_prior_model(c: &mut Criterion) { BenchmarkId::new("training on ", format!("dataset {nfeatures}x{nrows}")), |bencher| { bencher.iter(|| { - params - .fit_with(None, std::hint::black_box(&dataset)) - .unwrap(); + params.fit_with(None, black_box(&dataset)).unwrap(); }); }, ); @@ -52,10 +50,7 @@ fn fit_with_prior_model(c: &mut Criterion) { |bencher| { bencher.iter(|| { let _ = params - .fit_with( - std::hint::black_box(Some(model.clone())), - std::hint::black_box(&dataset), - ) + .fit_with(black_box(Some(model.clone())), black_box(&dataset)) .unwrap(); }); }, @@ -80,7 +75,7 @@ fn predict(c: &mut Criterion) { BenchmarkId::new("predicting on ", format!("dataset {nfeatures}x{nrows}")), |bencher| { bencher.iter(|| { - model.predict(std::hint::black_box(&dataset)); + model.predict(black_box(&dataset)); }); }, ); diff --git a/algorithms/linfa-ica/Cargo.toml b/algorithms/linfa-ica/Cargo.toml index 3d0299dc7..9eb052b44 100644 --- a/algorithms/linfa-ica/Cargo.toml +++ b/algorithms/linfa-ica/Cargo.toml @@ -39,7 +39,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] ndarray-npy = { version = "0.9", default-features = false } paste = "1.0" -criterion = "0.7" +criterion = "0.5" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } [[bench]] diff --git a/algorithms/linfa-linear/Cargo.toml b/algorithms/linfa-linear/Cargo.toml index d98378ed9..340d9ab7f 100644 --- a/algorithms/linfa-linear/Cargo.toml +++ b/algorithms/linfa-linear/Cargo.toml @@ -44,7 +44,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ "diabetes", ] } approx = "0.5" -criterion = "0.7" +criterion = "0.5" statrs = "0.18" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-nn/Cargo.toml b/algorithms/linfa-nn/Cargo.toml index ff26ae333..dd5a03b1c 100644 --- a/algorithms/linfa-nn/Cargo.toml +++ b/algorithms/linfa-nn/Cargo.toml @@ -37,7 +37,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] approx = "0.5" -criterion = "0.7" +criterion = "0.5" rand_xoshiro = "0.6" ndarray-rand = "0.15" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } diff --git a/algorithms/linfa-pls/Cargo.toml b/algorithms/linfa-pls/Cargo.toml index 15a6be23e..a2d0f6fd3 100644 --- a/algorithms/linfa-pls/Cargo.toml +++ b/algorithms/linfa-pls/Cargo.toml @@ -42,7 +42,7 @@ linfa-datasets = { version = "0.7.1", path = "../../datasets", features = [ ] } approx = "0.5" rand_xoshiro = "0.6" -criterion = "0.7" +criterion = "0.5" statrs = "0.18" [[bench]] diff --git a/algorithms/linfa-preprocessing/Cargo.toml b/algorithms/linfa-preprocessing/Cargo.toml index c429a60d1..8adae4fd9 100644 --- a/algorithms/linfa-preprocessing/Cargo.toml +++ b/algorithms/linfa-preprocessing/Cargo.toml @@ -53,7 +53,7 @@ curl = "0.4.35" flate2 = "1.0.20" tar = "0.4.33" linfa = { version = "0.7.1", path = "../..", features = ["benchmarks"] } -criterion = "0.7" +criterion = "0.5" statrs = "0.18" # FIXME: Disabled as dataset link is broken diff --git a/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs b/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs index 5a9960050..9eaabd045 100644 --- a/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs +++ b/algorithms/linfa-preprocessing/benches/linear_scaler_bench.rs @@ -1,4 +1,4 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::{Fit, Transformer}; use linfa_datasets::generate::make_dataset; @@ -24,9 +24,9 @@ fn bench(c: &mut Criterion) { |bencher| { bencher.iter(|| { liner_scaler - .fit(std::hint::black_box(&dataset)) + .fit(black_box(&dataset)) .unwrap() - .transform(std::hint::black_box(dataset.view())); + .transform(black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs b/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs index 26d8bedac..f0cb9ae81 100644 --- a/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs +++ b/algorithms/linfa-preprocessing/benches/norm_scaler_bench.rs @@ -1,4 +1,4 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::Transformer; use linfa_datasets::generate::make_dataset; @@ -23,7 +23,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new(fn_name, format!("{nfeatures}x{size}")), |bencher| { bencher.iter(|| { - scaler.transform(std::hint::black_box(dataset.view())); + scaler.transform(black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs b/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs index dd85d16e4..91c821f81 100644 --- a/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs +++ b/algorithms/linfa-preprocessing/benches/vectorizer_bench.rs @@ -5,7 +5,7 @@ use linfa_preprocessing::CountVectorizer; use std::path::Path; use tar::Archive; -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; fn download_20news_bydate() { @@ -149,14 +149,14 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Vectorizer", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_vectorizer(std::hint::black_box(&file_names)); + fit_vectorizer(black_box(&file_names)); }); }, ); benchmark.bench_function(BenchmarkId::new("Fit-Tf-Idf", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_tf_idf(std::hint::black_box(&file_names)); + fit_tf_idf(black_box(&file_names)); }); }); @@ -164,7 +164,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Transfor-Vectorizer", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_transform_vectorizer(std::hint::black_box(&file_names)); + fit_transform_vectorizer(black_box(&file_names)); }); }, ); @@ -173,7 +173,7 @@ fn bench(c: &mut Criterion) { BenchmarkId::new("Fit-Transfor-Tf-Idf", "20news_bydate"), |bencher| { bencher.iter(|| { - fit_transform_tf_idf(std::hint::black_box(&file_names)); + fit_transform_tf_idf(black_box(&file_names)); }); }, ); diff --git a/algorithms/linfa-preprocessing/benches/whitening_bench.rs b/algorithms/linfa-preprocessing/benches/whitening_bench.rs index 94fa1b3c7..6ec6b27fa 100644 --- a/algorithms/linfa-preprocessing/benches/whitening_bench.rs +++ b/algorithms/linfa-preprocessing/benches/whitening_bench.rs @@ -1,4 +1,4 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; +use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use linfa::benchmarks::config; use linfa::traits::Fit; use linfa::traits::Transformer; @@ -25,9 +25,9 @@ fn bench(c: &mut Criterion) { |bencher| { bencher.iter(|| { whitener - .fit(std::hint::black_box(&dataset)) + .fit(black_box(&dataset)) .unwrap() - .transform(std::hint::black_box(dataset.view())); + .transform(black_box(dataset.view())); }); }, ); diff --git a/algorithms/linfa-trees/Cargo.toml b/algorithms/linfa-trees/Cargo.toml index 95129df95..3e0ebc470 100644 --- a/algorithms/linfa-trees/Cargo.toml +++ b/algorithms/linfa-trees/Cargo.toml @@ -31,7 +31,7 @@ linfa = { version = "0.7.1", path = "../.." } [dev-dependencies] rand = { version = "0.8", features = ["small_rng"] } -criterion = "0.7" +criterion = "0.5" approx = "0.5" linfa-datasets = { version = "0.7.1", path = "../../datasets/", features = [ "iris",