Skip to content

Commit 4004fec

Browse files
authored
Merge branch 'rust-ml:master' into master
2 parents 01c8224 + b807674 commit 4004fec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1151
-231
lines changed

.github/workflows/checking.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
toolchain:
13-
- 1.67.0
13+
- 1.70.0
1414
- stable
1515
- nightly
1616
os:

.github/workflows/codequality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
toolchain:
13-
- 1.67.0
13+
- 1.70.0
1414
- stable
1515

1616
steps:

.github/workflows/testing.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
toolchain:
13-
- 1.67.0
13+
- 1.70.0
1414
- stable
1515
os:
1616
- ubuntu-latest
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
toolchain:
38-
- 1.67.0
38+
- 1.70.0
3939
- stable
4040
os:
4141
- ubuntu-latest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ poetry.lock
3636
# Generated artifacts of website (with Zola)
3737
docs/website/public/*
3838
docs/website/static/rustdocs/
39+
40+
# Downloaded data for the linfa-preprocessing benches
41+
20news/

Cargo.toml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [
55
"Luca Palmieri <rust@lpalmieri.com>",
66
"Lorenz Schmidt <bytesnake@mailbox.org>",
77
"Paul Körbitz <koerbitz@google.com>",
8-
"Yuhan Lin <yuhanliin@protonmail.com>"
8+
"Yuhan Lin <yuhanliin@protonmail.com>",
99
]
1010
description = "A Machine Learning framework for Rust"
1111
edition = "2018"
@@ -41,12 +41,12 @@ rand = { version = "0.8", features = ["small_rng"] }
4141
approx = "0.4"
4242

4343
ndarray = { version = "0.15", features = ["approx"] }
44-
ndarray-linalg = { version = "0.15", optional = true }
44+
ndarray-linalg = { version = "0.16", optional = true }
4545
sprs = { version = "0.11", default-features = false }
4646

4747
thiserror = "1.0"
4848

49-
criterion = { version = "0.4.0", optional = true}
49+
criterion = { version = "0.4.0", optional = true }
5050

5151
[dependencies.serde_crate]
5252
package = "serde"
@@ -57,17 +57,22 @@ features = ["std", "derive"]
5757

5858
[dev-dependencies]
5959
ndarray-rand = "0.14"
60-
linfa-datasets = { path = "datasets", features = ["winequality", "iris", "diabetes", "generate"] }
60+
linfa-datasets = { path = "datasets", features = [
61+
"winequality",
62+
"iris",
63+
"diabetes",
64+
"generate",
65+
] }
6166
statrs = "0.16.0"
6267

6368
[target.'cfg(not(windows))'.dependencies]
64-
pprof = { version = "0.11.0", features = ["flamegraph", "criterion"], optional = true}
69+
pprof = { version = "0.11.0", features = [
70+
"flamegraph",
71+
"criterion",
72+
], optional = true }
6573

6674
[workspace]
67-
members = [
68-
"algorithms/*",
69-
"datasets",
70-
]
75+
members = ["algorithms/*", "datasets"]
7176

7277
[profile.release]
7378
opt-level = 3
File renamed without changes.

algorithms/linfa-bayes/src/gaussian_nb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ where
8484
let nclass = xclass.nrows();
8585

8686
// We compute the update of the gaussian mean and variance
87-
let mut class_info = model
87+
let class_info = model
8888
.class_info
8989
.entry(class)
9090
.or_insert_with(GaussianClassInfo::default);

algorithms/linfa-bayes/src/multinomial_nb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
let nclass = xclass.nrows();
7272

7373
// We compute the feature log probabilities and feature counts on the slice corresponding to the current class
74-
let mut class_info = model
74+
let class_info = model
7575
.class_info
7676
.entry(class)
7777
.or_insert_with(MultinomialClassInfo::default);

algorithms/linfa-clustering/Cargo.toml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@ edition = "2018"
55
authors = [
66
"Luca Palmieri <rust@lpalmieri.com>",
77
"xd009642 <danielmckenna93@gmail.com>",
8-
"Rémi Lafage <remi.lafage@onera.fr>"
8+
"Rémi Lafage <remi.lafage@onera.fr>",
99
]
1010
description = "A collection of clustering algorithms"
1111
license = "MIT OR Apache-2.0"
1212

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

16-
keywords = ["clustering", "machine-learning", "linfa", "k-means", "unsupervised"]
16+
keywords = [
17+
"clustering",
18+
"machine-learning",
19+
"linfa",
20+
"k-means",
21+
"unsupervised",
22+
]
1723
categories = ["algorithms", "mathematics", "science"]
1824

1925
[features]
@@ -28,9 +34,9 @@ default-features = false
2834
features = ["std", "derive"]
2935

3036
[dependencies]
31-
ndarray = { version = "0.15", features = ["rayon", "approx"]}
37+
ndarray = { version = "0.15", features = ["rayon", "approx"] }
3238
linfa-linalg = { version = "0.1", default-features = false }
33-
ndarray-linalg = { version = "0.15", optional = true }
39+
ndarray-linalg = { version = "0.16", optional = true }
3440
ndarray-rand = "0.14"
3541
ndarray-stats = "0.5"
3642
num-traits = "0.2"
@@ -44,7 +50,9 @@ noisy_float = "0.2.0"
4450

4551
[dev-dependencies]
4652
ndarray-npy = { version = "0.8", default-features = false }
47-
linfa-datasets = { version = "0.7.0", path = "../../datasets", features = ["generate"] }
53+
linfa-datasets = { version = "0.7.0", path = "../../datasets", features = [
54+
"generate",
55+
] }
4856
criterion = "0.4.0"
4957
serde_json = "1"
5058
approx = "0.4"

algorithms/linfa-clustering/src/appx_dbscan/cells_grid/cell.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ use linfa::Float;
44
use linfa_nn::distance::{Distance, L2Dist};
55
use ndarray::{Array1, ArrayView1, ArrayView2, ArrayViewMut1};
66
use partitions::PartitionVec;
7+
#[cfg(feature = "serde")]
8+
use serde_crate::{Deserialize, Serialize};
79

810
#[derive(Clone, Debug, PartialEq, Eq)]
11+
#[cfg_attr(
12+
feature = "serde",
13+
derive(Serialize, Deserialize),
14+
serde(crate = "serde_crate")
15+
)]
916
/// A point in a D dimensional euclidean space that memorizes its
1017
/// status: 'core' or 'non core'
1118
pub struct StatusPoint {
@@ -16,10 +23,7 @@ pub struct StatusPoint {
1623

1724
impl StatusPoint {
1825
pub fn new(point_index: usize) -> StatusPoint {
19-
StatusPoint {
20-
point_index,
21-
is_core: false,
22-
}
26+
StatusPoint { point_index, is_core: false }
2327
}
2428

2529
pub fn is_core(&self) -> bool {
@@ -32,6 +36,11 @@ impl StatusPoint {
3236
}
3337

3438
#[derive(Clone, Debug, PartialEq)]
39+
#[cfg_attr(
40+
feature = "serde",
41+
derive(Serialize, Deserialize),
42+
serde(crate = "serde_crate")
43+
)]
3544
/// Informations regarding the cell used in various stages of the approximate DBSCAN
3645
/// algorithm if it is a core cell
3746
pub struct CoreCellInfo<F: Float> {
@@ -42,6 +51,11 @@ pub struct CoreCellInfo<F: Float> {
4251
}
4352

4453
#[derive(Clone, Debug, PartialEq)]
54+
#[cfg_attr(
55+
feature = "serde",
56+
derive(Serialize, Deserialize),
57+
serde(crate = "serde_crate")
58+
)]
4559
/// A cell from a grid that partitions the D dimensional euclidean space.
4660
pub struct Cell<F: Float> {
4761
/// The index of the intervals of the D dimensional axes where this cell lies

0 commit comments

Comments
 (0)