Skip to content

Commit

Permalink
Release 0.2.1
Browse files Browse the repository at this point in the history
 * remove features for testing
 * fill up some missing information in Cargo.toml
 * make ready to publish to crates.io
  • Loading branch information
bytesnake committed Nov 29, 2020
1 parent b7387ea commit 405f2f7
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 44 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linfa"
version = "0.2.0"
version = "0.2.1"
authors = [
"Luca Palmieri <[email protected]>",
"Lorenz Schmidt <[email protected]>",
Expand All @@ -10,19 +10,21 @@ description = "A Machine Learning framework for Rust"
edition = "2018"
license = "MIT/Apache-2.0"

repository = "https://github.com/LukeMathWalker/linfa"
repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["machine-learning", "linfa", "ai", "ml"]
categories = ["algorithms", "mathematics", "science"]

exclude = [".github/"]

[dependencies]
num-traits = "0.1.32"
num-traits = "0.2"
ndarray = { version = "0.13", default-features = false }

[dev-dependencies]
rand = "0.7"
ndarray-rand = "0.11"
ndarray-rand = "0.12"
approx = "0.3"

[workspace]
Expand Down
10 changes: 7 additions & 3 deletions linfa-clustering/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[package]
name = "linfa-clustering"
version = "0.2.0"
version = "0.2.1"
edition = "2018"
authors = ["Luca Palmieri <[email protected]>"]
authors = [
"Luca Palmieri <[email protected]>",
"xd009642 <[email protected]>",
"Rémi Lafage <[email protected]>"
]
description = "A collection of clustering algorithms"
license = "MIT/Apache-2.0"

Expand All @@ -28,7 +32,7 @@ sprs = "0.7"
num-traits = "0.1.32"
rand_isaac = "0.2.0"

linfa = { path = ".." }
linfa = { version = "0.2.1", path = ".." }

[dev-dependencies]
openblas-src = { version = "0.9", default-features = false, features = ["system"] }
Expand Down
11 changes: 6 additions & 5 deletions linfa-hierarchical/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
[package]
name = "linfa-hierarchical"
version = "0.2.0"
version = "0.2.1"
authors = ["Lorenz Schmidt <[email protected]>"]
edition = "2018"

description = "Support Vector Machines"
description = "Agglomerative Hierarchical clustering"
license = "MIT/Apache-2.0"

repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["hierachical", "agglomerative", "clustering", "cluster", "machine-learning", "linfa", "unsupervised"]
keywords = ["hierachical", "agglomerative", "clustering", "machine-learning", "linfa"]
categories = ["algorithms", "mathematics", "science"]

[dependencies]
ndarray = { version = "0.13", default-features = false }
kodama = "0.2"

linfa = { path = ".." }
linfa-kernel = { path = "../linfa-kernel" }
linfa = { version = "0.2.1", path = ".." }
linfa-kernel = { version = "0.2.1", path = "../linfa-kernel" }

[dev-dependencies]
rand = "0.7"
ndarray-rand = "0.11"
csv = "1.1"
ndarray-csv = "0.4"
Expand Down
6 changes: 3 additions & 3 deletions linfa-ica/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linfa-ica"
version = "0.2.0"
version = "0.2.1"
authors = ["VasanthakumarV <[email protected]>"]
description = "A collection of Independent Component Analysis (ICA) algorithms"
edition = "2018"
Expand All @@ -17,10 +17,10 @@ ndarray = { version = "0.13", default-features = false }
ndarray-rand = "0.11"
ndarray-stats = "0.3"
ndarray-linalg = "0.12"
num-traits = "0.1.32"
num-traits = "0.2"
rand_isaac = "0.2.0"

linfa = { path = ".." }
linfa = { version = "0.2.1", path = ".." }

[dev-dependencies]
openblas-src = { version = "0.9", default-features = false, features = ["system"] }
Expand Down
6 changes: 3 additions & 3 deletions linfa-kernel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "linfa-kernel"
version = "0.2.0"
version = "0.2.1"
authors = ["Lorenz Schmidt <[email protected]>"]
description = "Kernel methods for non-linear algorithms"
edition = "2018"
license = "MIT/Apache-2.0"

repository = "https://github.com/rust-ml/linfa/"
repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["kernel", "machine-learning", "linfa"]
Expand All @@ -18,4 +18,4 @@ sprs = { version = "0.9", default-features = false }
hnsw = "0.6"
space = "0.10"

linfa = { path = ".." }
linfa = { version = "0.2.1", path = ".." }
17 changes: 14 additions & 3 deletions linfa-linear/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[package]
name = "linfa-linear"
version = "0.2.0"
authors = ["Paul Körbitz / Google <[email protected]>"]
version = "0.2.1"
authors = [
"Paul Körbitz / Google <[email protected]>",
"VasanthakumarV <[email protected]>"
]

description = "A Machine Learning framework for Rust"
edition = "2018"
workspace = ".."
license = "MIT/Apache-2.0"

repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["machine-learning", "linfa", "ai", "ml", "linear"]
categories = ["algorithms", "mathematics", "science"]

[dependencies]
ndarray = {version = "0.13", features = ["blas", "approx"]}
Expand Down
12 changes: 10 additions & 2 deletions linfa-logistic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
[package]
name = "linfa-logistic"
version = "0.2.0"
version = "0.2.1"
authors = ["Paul Körbitz / Google <[email protected]>"]

description = "A Machine Learning framework for Rust"
edition = "2018"
workspace = ".."
license = "MIT/Apache-2.0"

repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["machine-learning", "linfa", "ai", "ml", "linear"]
categories = ["algorithms", "mathematics", "science"]

[dependencies]
ndarray = {version = "0.13", features = ["blas", "approx"]}
Expand Down
19 changes: 6 additions & 13 deletions linfa-reduction/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linfa-reduction"
version = "0.2.0"
version = "0.2.1"
authors = ["Lorenz Schmidt <[email protected]>"]
description = "A collection of dimensionality reduction techniques"
edition = "2018"
Expand All @@ -9,27 +9,20 @@ license = "MIT/Apache-2.0"
repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["dimensionality reduction", "machine-learning", "linfa", "spectral", "unsupervised"]
keywords = ["reduction", "machine-learning", "linfa", "spectral", "unsupervised"]
categories = ["algorithms", "mathematics", "science"]

[features]
default = []
tests-openblas-system = ["openblas-src/system"]
tests-openblas-build = ["openblas-src/cblas", "openblas-src/lapacke"]

[dependencies]
ndarray = "0.13"
ndarray-rand = "0.11"
ndarray-stats = "0.3"
ndarray-linalg = "0.12"
num-traits = "0.1.32"
num-traits = "0.2"

linfa = { path = ".." }
linfa-kernel = { path = "../linfa-kernel" }
linfa = { version = "0.2.1", path = ".." }
linfa-kernel = { version = "0.2.1", path = "../linfa-kernel" }

[dev-dependencies]
openblas-src = { version = "0.9", default-features=false }
openblas-src = { version = "0.9", default-features=false, features = ["system"] }
rand_isaac = "0.2.0"
ndarray-npy = { version = "0.5", default-features = false }
criterion = "0.3"
approx = "0.3"
8 changes: 4 additions & 4 deletions linfa-svm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linfa-svm"
version = "0.2.0"
version = "0.2.1"
edition = "2018"
authors = ["Lorenz Schmidt <[email protected]>"]
description = "Support Vector Machines"
Expand All @@ -9,16 +9,16 @@ license = "MIT/Apache-2.0"
repository = "https://github.com/rust-ml/linfa"
readme = "README.md"

keywords = ["svm", "support vector machine", "machine-learning", "linfa", "supervised"]
keywords = ["svm", "machine-learning", "linfa", "supervised"]
categories = ["algorithms", "mathematics", "science"]

[dependencies]
ndarray = { version = "0.13", default-features=false, features=["blas"] }
ndarray-rand = "0.11"
num-traits = "0.1.32"

linfa = { path = ".." }
linfa-kernel = { path = "../linfa-kernel" }
linfa = { version = "0.2.1", path = ".." }
linfa-kernel = { version = "0.2.1", path = "../linfa-kernel" }

[dev-dependencies]
openblas-src = { version = "0.9", default-features = false, features = ["system"] }
Expand Down
4 changes: 2 additions & 2 deletions linfa-trees/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linfa-trees"
version = "0.2.0"
version = "0.2.1"
edition = "2018"
authors = ["Moss Ebeling <[email protected]>"]
description = "A collection of tree-based algorithms"
Expand All @@ -22,7 +22,7 @@ ndarray-npy = { version = "0.5", default-features = false }
criterion = "0.3"
serde_json = "1"
approx = "0.3"
linfa-clustering = { path = "../linfa-clustering" }
#linfa-clustering = { version = "0.2.1", path = "../linfa-clustering" }

[[bench]]
name = "decision_tree"
Expand Down
47 changes: 45 additions & 2 deletions linfa-trees/examples/decision_tree.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,53 @@
use linfa_clustering::generate_blobs;
use linfa_trees::{DecisionTree, DecisionTreeParams, SplitQuality};
use ndarray::{array, Array, ArrayBase, Data, Ix1};
use ndarray::{array, Array, ArrayBase, Data, Ix1, Ix2, Array2, s};
use ndarray_rand::rand::Rng;
use ndarray_rand::rand::SeedableRng;
use ndarray_rand::rand_distr::StandardNormal;
use ndarray_rand::RandomExt;
use rand_isaac::Isaac64Rng;
use std::iter::FromIterator;

/// Given an input matrix `blob_centroids`, with shape `(n_blobs, n_features)`,
/// generate `blob_size` data points (a "blob") around each of the blob centroids.
///
/// More specifically, each blob is formed by `blob_size` points sampled from a normal
/// distribution centered in the blob centroid with unit variance.
///
/// `generate_blobs` can be used to quickly assemble a synthetic dataset to test or
/// benchmark various clustering algorithms on a best-case scenario input.
pub fn generate_blobs(
blob_size: usize,
blob_centroids: &ArrayBase<impl Data<Elem = f64>, Ix2>,
rng: &mut impl Rng,
) -> Array2<f64> {
let (n_centroids, n_features) = blob_centroids.dim();
let mut blobs: Array2<f64> = Array2::zeros((n_centroids * blob_size, n_features));

for (blob_index, blob_centroid) in blob_centroids.genrows().into_iter().enumerate() {
let blob = generate_blob(blob_size, &blob_centroid, rng);

let indexes = s![blob_index * blob_size..(blob_index + 1) * blob_size, ..];
blobs.slice_mut(indexes).assign(&blob);
}
blobs
}

/// Generate `blob_size` data points (a "blob") around `blob_centroid`.
///
/// More specifically, the blob is formed by `blob_size` points sampled from a normal
/// distribution centered in `blob_centroid` with unit variance.
///
/// `generate_blob` can be used to quickly assemble a synthetic stereotypical cluster.
pub fn generate_blob(
blob_size: usize,
blob_centroid: &ArrayBase<impl Data<Elem = f64>, Ix1>,
rng: &mut impl Rng,
) -> Array2<f64> {
let shape = (blob_size, blob_centroid.len());
let origin_blob: Array2<f64> = Array::random_using(shape, StandardNormal, rng);
origin_blob + blob_centroid
}

fn accuracy(
labels: &ArrayBase<impl Data<Elem = u64>, Ix1>,
pred: &ArrayBase<impl Data<Elem = u64>, Ix1>,
Expand Down

0 comments on commit 405f2f7

Please sign in to comment.