Skip to content

Commit ce8a815

Browse files
authored
Linfa's 0.4.0 release (#127)
* Bump version 0.4.0, add release notes * Add t-SNE example to release notes * Add example for t-SNE and start writing preprocessing example * Fix typo * Add example for TF-IDF text preprocessing * Explain that target construction is omitted and traits changes * Add contribute section on the new lapack traits * Link to crates.io in the base crate documentation * Link to crates.io in the base crate documentation * Add mnist example * Run rustfmt * Fix mnist example
1 parent a5a479f commit ce8a815

25 files changed

Lines changed: 349 additions & 53 deletions

File tree

‎CONTRIBUTE.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,15 @@ fn main() {
128128
/// ...
129129
}
130130
```
131+
132+
## Use the lapack trait bound
133+
134+
When you want to implement an algorithm which requires the [Lapack](https://docs.rs/ndarray-linalg/0.13.1/ndarray_linalg/types/trait.Lapack.html) bound, then you could add the trait bound to the `linfa::Float` standard bound, e.g. `F: Float + Scalar + Lapack`. If you do that you're currently running into conflicting function definitions of [num_traits::Float](https://docs.rs/num-traits/0.2.14/num_traits/float/trait.Float.html) and [cauchy::Scalar](https://docs.rs/cauchy/0.4.0/cauchy/trait.Scalar.html) with the first defined for real-valued values and the second for complex values.
135+
136+
If you want to avoid that you can use the `linfa::dataset::{WithLapack, WithoutLapack}` traits, which basically adds the lapack trait bound for a block and then removes it again so that the conflicts can be avoided. For example:
137+
```rust
138+
let decomp = covariance.with_lapack().cholesky(UPLO::Lower)?;
139+
let sol = decomp
140+
.solve_triangular(UPLO::Lower, Diag::NonUnit, &Array::eye(n_features))?
141+
.without_lapack();
142+
```

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = [
55
"Luca Palmieri <rust@lpalmieri.com>",
66
"Lorenz Schmidt <bytesnake@mailbox.org>",

‎algorithms/linfa-bayes/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-bayes"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = ["VasanthakumarV <vasanth260m12@gmail.com>"]
55
description = "Collection of Naive Bayes Algorithms"
66
edition = "2018"
@@ -15,8 +15,8 @@ ndarray = { version = "0.14" , features = ["blas", "approx"]}
1515
ndarray-stats = "0.4"
1616
thiserror = "1"
1717

18-
linfa = { version = "0.3.1", path = "../.." }
18+
linfa = { version = "0.4.0", path = "../.." }
1919

2020
[dev-dependencies]
2121
approx = "0.4"
22-
linfa-datasets = { version = "0.3.1", path = "../../datasets", features = ["winequality"] }
22+
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["winequality"] }

‎algorithms/linfa-clustering/Cargo.toml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-clustering"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
edition = "2018"
55
authors = [
66
"Luca Palmieri <rust@lpalmieri.com>",
@@ -36,7 +36,8 @@ num-traits = "0.2"
3636
rand_isaac = "0.3"
3737
thiserror = "1"
3838
partitions = "0.2.4"
39-
linfa = { version = "0.3.1", path = "../..", features = ["ndarray-linalg"] }
39+
40+
linfa = { version = "0.4.0", path = "../..", features = ["ndarray-linalg"] }
4041

4142
[dev-dependencies]
4243
ndarray-npy = { version = "0.7", default-features = false }

‎algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ impl<F: Float> GaussianMixtureModel<F> {
257257
let n_features = covariances.shape()[1];
258258
let mut precisions_chol = Array::zeros((n_clusters, n_features, n_features));
259259
for (k, covariance) in covariances.outer_iter().enumerate() {
260-
dbg!(&covariance.shape());
261-
dbg!(&covariance.with_lapack().shape());
262260
let decomp = covariance.with_lapack().cholesky(UPLO::Lower)?;
263261
let sol = decomp
264262
.solve_triangular(UPLO::Lower, Diag::NonUnit, &Array::eye(n_features))?

‎algorithms/linfa-elasticnet/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-elasticnet"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = [
55
"Paul Körbitz / Google <koerbitz@google.com>",
66
"Lorenz Schmidt <bytesnake@mailbox.org>"
@@ -35,9 +35,9 @@ num-traits = "0.2"
3535
approx = "0.4"
3636
thiserror = "1"
3737

38-
linfa = { version = "0.3.1", path = "../.." }
38+
linfa = { version = "0.4.0", path = "../.." }
3939

4040
[dev-dependencies]
41-
linfa-datasets = { version = "0.3.1", path = "../../datasets", features = ["diabetes"] }
41+
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["diabetes"] }
4242
ndarray-rand = "0.13"
4343
rand_isaac = "0.3"

‎algorithms/linfa-hierarchical/Cargo.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-hierarchical"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = ["Lorenz Schmidt <lorenz.schmidt@mailbox.org>"]
55
edition = "2018"
66

@@ -17,10 +17,10 @@ categories = ["algorithms", "mathematics", "science"]
1717
ndarray = { version = "0.14", default-features = false }
1818
kodama = "0.2"
1919

20-
linfa = { version = "0.3.1", path = "../.." }
21-
linfa-kernel = { version = "0.3.1", path = "../linfa-kernel" }
20+
linfa = { version = "0.4.0", path = "../.." }
21+
linfa-kernel = { version = "0.4.0", path = "../linfa-kernel" }
2222

2323
[dev-dependencies]
2424
rand = "0.8"
2525
ndarray-rand = "0.13"
26-
linfa-datasets = { version = "0.3.1", path = "../../datasets", features = ["iris"] }
26+
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["iris"] }

‎algorithms/linfa-ica/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-ica"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = ["VasanthakumarV <vasanth260m12@gmail.com>"]
55
description = "A collection of Independent Component Analysis (ICA) algorithms"
66
edition = "2018"
@@ -32,7 +32,7 @@ num-traits = "0.2"
3232
rand_isaac = "0.3"
3333
thiserror = "1"
3434

35-
linfa = { version = "0.3.1", path = "../..", features = ["ndarray-linalg"] }
35+
linfa = { version = "0.4.0", path = "../..", features = ["ndarray-linalg"] }
3636

3737
[dev-dependencies]
3838
ndarray-npy = { version = "0.7", default-features = false }

‎algorithms/linfa-kernel/Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-kernel"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = ["Lorenz Schmidt <bytesnake@mailbox.org>"]
55
description = "Kernel methods for non-linear algorithms"
66
edition = "2018"
@@ -30,4 +30,4 @@ sprs = { version="0.9.4", default-features = false }
3030
hnsw = "0.6"
3131
space = "0.10"
3232

33-
linfa = { version = "0.3.1", path = "../.." }
33+
linfa = { version = "0.4.0", path = "../.." }

‎algorithms/linfa-linear/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "linfa-linear"
3-
version = "0.3.1"
3+
version = "0.4.0"
44
authors = [
55
"Paul Körbitz / Google <koerbitz@google.com>",
66
"VasanthakumarV <vasanth260m12@gmail.com>"
@@ -25,8 +25,8 @@ argmin = { version = "0.4", features = ["ndarrayl"] }
2525
serde = { version = "1.0", default-features = false, features = ["derive"] }
2626
thiserror = "1"
2727

28-
linfa = { version = "0.3.1", path = "../.." }
28+
linfa = { version = "0.4.0", path = "../.." }
2929

3030
[dev-dependencies]
31-
linfa-datasets = { version = "0.3.1", path = "../../datasets", features = ["diabetes"] }
31+
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["diabetes"] }
3232
approx = "0.4"

0 commit comments

Comments
 (0)