Skip to content

Commit d2d0e67

Browse files
authored
0.5.0 release (#171)
* Retroactively update changelog for 0.4.0 * Update changelog for 0.5.0 * Bump all Cargo.toml versions to 0.5.0 * Update contribute doc * Add new release webpage and rename 0.4.0 release page name * Add winequality example and fix log-sum-exp clipping
1 parent 208a762 commit d2d0e67

25 files changed

Lines changed: 182 additions & 63 deletions

File tree

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
Version 0.5.0 - 2021-10-20
2+
========================
3+
4+
New Algorithms
5+
-----------
6+
7+
* Nearest neighbour algorithms and traits have been added as `linfa-nn` by [@YuhanLiin]
8+
* OPTICS has been added to `linfa-clustering` by [@xd009642]
9+
* Multinomial logistic regression has been added to `linfa-logistic` by [@YuhanLiin]
10+
11+
Changes
12+
-----------
13+
* use least squares solver from `ndarray-linalg` in `linfa-linear` (3dc9cb0)
14+
* optimized DBSCAN by replacing linear range query implementation with KD-tree (44f91d0)
15+
* allow distance metrics other than Euclidean to be used for KMeans (4e58d8d)
16+
* enable models to write prediction results into existing memory without allocating (37bc25b)
17+
* bumped `ndarray` version to 0.15 and reduced duplicated dependencies (603f821)
18+
* introduce `ParamGuard` trait to algorithm parameter sets to enable both explicit and implicit parameter checking (01f912a)
19+
* replace uses of HNSW with `linfa-nn` (208a762)
20+
21+
Version 0.4.0 - 2021-04-28
22+
========================
23+
24+
New Algorithms
25+
-----------
26+
27+
* Partial Least Squares Regression has been added as `linfa-pls` by [@relf]
28+
* Barnes-Hut t-SNE wrapper has been added as `linfa-tsne` by [@frjnn]
29+
* Count-vectorizer and IT-IDF normalization has been added as `linfa-preprocessing` by [@Sauro98]
30+
* Platt scaling has been added to `linfa-svm` by [@bytesnake]
31+
* Incremental KMeans and KMeans++ and KMeans|| initialization methods added to `linfa-clustering` by [@YuhanLiin]
32+
33+
Changes
34+
-----------
35+
* bumped `ndarray` version to 0.14 (8276bdc)
36+
* change trait signature of `linfa::Fit` to return `Result` (a5a479f)
37+
* add `cross_validate` to perform K-folding (a5a479f)
38+
139
Version 0.3.1 - 2021-03-11
240
========================
341

CONTRIBUTE.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,25 @@ where the type of the input dataset is `&Dataset<Kernel<F>, Array1<bool>>`. It p
2020

2121
The [Predict](src/traits.rs) trait has its own section later in this document, while for an example of a `Transformer` please look into the [linfa-kernel](linfa-kernel/src/lib.rs) implementation.
2222

23-
## Parameters and builder
23+
## Parameters and checking
2424

2525
An algorithm has a number of hyperparameters, describing how it operates. This section describes how the algorithm's structs should be organized in order to conform with other implementations.
2626

27-
Imagine we have an implementation of `MyAlg`, there should a separate struct called `MyAlgParams`. The method `MyAlg::params(..) -> MyAlgParams` constructs a parameter set with default parameters and optionally required arguments (for example the number of clusters). If no parameters are required, then `std::default::Default` can be implemented as well:
27+
Sometimes only an algorithm's parameters must be checked for validity. As such, Linfa makes a distinction between checked and unchecked parameters. Unchecked parameters can be converted into checked parameters if the values are valid, and only checked parameters can be used to run the algorithm.
28+
29+
Imagine we have an implementation of `MyAlg`, there should separate structs called `MyAlgValidParams`, which are the checked parameters, and `MyAlgParams`, which are the unchecked parameters. The method `MyAlg::params(..) -> MyAlgParams` constructs a parameter set with default parameters and optionally required arguments (for example the number of clusters). `MyAlgValidParams` should be a struct that contains all the hyperparameters as fields, and `MyAlgParams` should just be a newtype that wraps `MyAlgValidParams`.
2830
```rust
29-
impl Default for MyAlgParams {
30-
fn default() -> MyAlgParams {
31-
MyAlg::params()
32-
}
31+
struct MyAlgValidParams {
32+
eps: f32,
33+
backwards: bool,
3334
}
35+
36+
struct MyAlgParams(MyAlgValidParams);
3437
```
3538

36-
The `MyAlgParams` should implement the Consuming Builder pattern, explained in the [Rust Book](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html). Each hyperparameter gets a single field in the struct, as well as a method to modify it. Sometimes a random number generator is used in the training process. Then two separate methods should take a seed or a random number generator. With the seed a default RNG is initialized, for example [Isaac64](https://docs.rs/rand_isaac/0.2.0/rand_isaac/isaac64/index.html).
39+
`MyAlgParams` should implement the Consuming Builder pattern, explained in the [Rust Book](https://doc.rust-lang.org/1.0.0/style/ownership/builders.html). Each hyperparameter gets a method to modify it. `MyAlgParams` should also implement the `ParamGuard` trait, which facilitates parameter checking. The associated type `ParamGuard::Checked` should be `MyAlgValidParams` and the `check_ref()` method should contain the parameter checking logic, while `check()` simply calls `check_ref()` before unwrapping the inner `MyAlgValidParams`.
3740

38-
With a constructed set of parameters, the `MyAlgParams::fit(..) -> Result<MyAlg>` executes the learning process and returns a learned state. If one of the parameters is invalid (for example out of a required range), then an `Error::InvalidState` should be returned. For transformers there is only `MyAlg`, and no `MyAlgParams`, because there is no hidden state to be learned.
41+
With a checked set of parameters, `MyAlgValidParams::fit(..) -> Result<MyAlg>` executes the learning process and returns a learned state. Due to blanket impls on `ParamGuard`, it's also possible to call `fit()` or `transform()` directly on `MyAlgParams` as well, which performs the parameter checking before the learning process.
3942

4043
Following this convention, the pattern can be used by the user like this:
4144
```rust
@@ -45,6 +48,11 @@ MyAlg::params()
4548
...
4649
.fit(&dataset)?;
4750
```
51+
or, if the checking is done explicitly:
52+
```rust
53+
let params = MyAlg::params().check();
54+
params.fit(&dataset);
55+
```
4856

4957
## Generic float types
5058

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.4.0"
3+
version = "0.5.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.4.0"
3+
version = "0.5.0"
44
authors = ["VasanthakumarV <vasanth260m12@gmail.com>"]
55
description = "Collection of Naive Bayes Algorithms"
66
edition = "2018"
@@ -15,8 +15,8 @@ ndarray = { version = "0.15" , features = ["blas", "approx"]}
1515
ndarray-stats = "0.5"
1616
thiserror = "1.0"
1717

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

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

algorithms/linfa-clustering/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-clustering"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
edition = "2018"
55
authors = [
66
"Luca Palmieri <rust@lpalmieri.com>",
@@ -37,8 +37,8 @@ rand_isaac = "0.3"
3737
space = "0.12"
3838
thiserror = "1.0"
3939
partitions = "0.2.4"
40-
linfa = { version = "0.4.0", path = "../..", features = ["ndarray-linalg"] }
41-
linfa-nn = { version = "0.1.0", path = "../linfa-nn" }
40+
linfa = { version = "0.5.0", path = "../..", features = ["ndarray-linalg"] }
41+
linfa-nn = { version = "0.5.0", path = "../linfa-nn" }
4242
noisy_float = "0.2.0"
4343

4444
[dev-dependencies]

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.4.0"
3+
version = "0.5.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.0"
3737

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

4040
[dev-dependencies]
41-
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["diabetes"] }
41+
linfa-datasets = { version = "0.5.0", path = "../../datasets", features = ["diabetes"] }
4242
ndarray-rand = "0.14"
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.4.0"
3+
version = "0.5.0"
44
authors = ["Lorenz Schmidt <lorenz.schmidt@mailbox.org>"]
55
edition = "2018"
66

@@ -18,10 +18,10 @@ ndarray = { version = "0.15", default-features = false }
1818
kodama = "0.2"
1919
thiserror = "=1.0.25"
2020

21-
linfa = { version = "0.4.0", path = "../.." }
22-
linfa-kernel = { version = "0.4.0", path = "../linfa-kernel" }
21+
linfa = { version = "0.5.0", path = "../.." }
22+
linfa-kernel = { version = "0.5.0", path = "../linfa-kernel" }
2323

2424
[dev-dependencies]
2525
rand = "0.8"
2626
ndarray-rand = "0.14"
27-
linfa-datasets = { version = "0.4.0", path = "../../datasets", features = ["iris"] }
27+
linfa-datasets = { version = "0.5.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.4.0"
3+
version = "0.5.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.0"
3434

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

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

algorithms/linfa-kernel/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-kernel"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
authors = ["Lorenz Schmidt <bytesnake@mailbox.org>"]
55
description = "Kernel methods for non-linear algorithms"
66
edition = "2018"
@@ -28,5 +28,5 @@ ndarray = "0.15"
2828
num-traits = "0.2"
2929
sprs = { version="0.11.0", default-features = false }
3030

31-
linfa = { version = "0.4.0", path = "../.." }
32-
linfa-nn = { version = "0.1.0", path = "../linfa-nn" }
31+
linfa = { version = "0.5.0", path = "../.." }
32+
linfa-nn = { version = "0.5.0", path = "../linfa-nn" }

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.4.0"
3+
version = "0.5.0"
44
authors = [
55
"Paul Körbitz / Google <koerbitz@google.com>",
66
"VasanthakumarV <vasanth260m12@gmail.com>"
@@ -25,8 +25,8 @@ argmin = { version = "0.4.6", features = ["ndarrayl"] }
2525
serde = { version = "1.0", default-features = false, features = ["derive"] }
2626
thiserror = "1.0"
2727

28-
linfa = { version = "0.4.0", path = "../..", features=["serde"] }
28+
linfa = { version = "0.5.0", path = "../..", features=["serde"] }
2929

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

0 commit comments

Comments
 (0)