Skip to content

Commit 1c459a8

Browse files
authored
CI maintenance (#368)
* Fix clippy warnings in linfa * Fix clippy warnings in linfa-bayes * Fix clippy warnings in linfa-clustering * Fix clippy warnings in linfa-elasticnet * Fix clippy warnings in linfa-ftrl * Fix clippy warnings in linfa-hierarchical * Fix clippy warnings in linfa-kernel * Fix clippy warnings in linfa-linear * Fix clippy warnings in linfa-logistic * Fix clippy warnings in linfa-nn * Fix clippy warnings in linfa-pls * Fix clippy warnings in linfa-preprocessing * Fix clippy warnings in linfa-svm * Fix clippy warnings in linfa-trees * Pin sprs to 1.11.1 sprs 1.11.2 pulls ndarray 0.16.1 while we still use ndarray 0.15.6 * Bump MSRV to 1.71 * Revert manual_inspect lint fix to keep MSRV 1.71 * Format * Bump MSRV to 1.71.1 (due to dep yoke 0.7.5) * Update codecov-action and cache actions * Fix doc
1 parent b807674 commit 1c459a8

File tree

62 files changed

+217
-236
lines changed

Some content is hidden

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

62 files changed

+217
-236
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.70.0
13+
- 1.71.1
1414
- stable
1515
- nightly
1616
os:

.github/workflows/codequality.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
toolchain:
13-
- 1.70.0
13+
- 1.71.1
1414
- stable
1515

1616
steps:
@@ -46,7 +46,7 @@ jobs:
4646
run: echo "::set-output name=version::$(cargo --version | cut -d ' ' -f 2)"
4747
shell: bash
4848

49-
- uses: actions/cache@v2
49+
- uses: actions/cache@v4
5050
id: tarpaulin-cache
5151
with:
5252
path: |
@@ -61,6 +61,8 @@ jobs:
6161
run: |
6262
cargo tarpaulin --verbose --timeout 120 --out Xml --all --release
6363
- name: Upload to codecov.io
64-
uses: codecov/codecov-action@v1
64+
uses: codecov/codecov-action@v4
6565
with:
66+
token: ${{ secrets.CODECOV_TOKEN }}
6667
fail_ci_if_error: true
68+
verbose: true

.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.70.0
13+
- 1.71.1
1414
- stable
1515
os:
1616
- ubuntu-latest
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
toolchain:
38-
- 1.70.0
38+
- 1.71.1
3939
- stable
4040
os:
4141
- ubuntu-latest

algorithms/linfa-bayes/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
`linfa-bayes` currently provides an implementation of the following methods:
1212

13-
- Gaussian Naive Bayes ([`GaussianNb`](crate::GaussianNb))
14-
- Multinomial Naive Nayes ([`MultinomialNb`](crate::MultinomialNb))
13+
- Gaussian Naive Bayes ([`GaussianNb`])
14+
- Multinomial Naive Nayes ([`MultinomialNb`]))
1515

1616
## Examples
1717

algorithms/linfa-bayes/src/base_nb.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ pub fn filter<F: Float, L: Label + Ord>(
7979
let index = y
8080
.into_iter()
8181
.enumerate()
82-
.filter_map(|(i, y)| (*ycondition == *y).then(|| i))
82+
.filter(|(_, y)| (*ycondition == **y))
83+
.map(|(i, _)| i)
8384
.collect::<Vec<_>>();
8485

8586
// We subset x to only records corresponding to the class represented in `ycondition`

algorithms/linfa-bayes/src/gaussian_nb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ where
133133
}
134134
}
135135

136-
impl<'a, F, L> GaussianNbValidParams<F, L>
136+
impl<F, L> GaussianNbValidParams<F, L>
137137
where
138138
F: Float,
139139
{
@@ -259,7 +259,7 @@ impl<F: Float, L: Label> GaussianNb<F, L> {
259259
}
260260
}
261261

262-
impl<'a, F, L> NaiveBayes<'a, F, L> for GaussianNb<F, L>
262+
impl<F, L> NaiveBayes<'_, F, L> for GaussianNb<F, L>
263263
where
264264
F: Float,
265265
L: Label + Ord,

algorithms/linfa-bayes/src/multinomial_nb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl<F: Float, L: Label> MultinomialNb<F, L> {
229229
}
230230
}
231231

232-
impl<'a, F, L> NaiveBayes<'a, F, L> for MultinomialNb<F, L>
232+
impl<F, L> NaiveBayes<'_, F, L> for MultinomialNb<F, L>
233233
where
234234
F: Float,
235235
L: Label + Ord,

algorithms/linfa-clustering/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ categories = ["algorithms", "mathematics", "science"]
2424

2525
[features]
2626
default = []
27+
blas = []
2728
serde = ["serde_crate", "ndarray/serde", "linfa-nn/serde"]
2829

2930
[dependencies.serde_crate]

algorithms/linfa-clustering/src/dbscan/algorithm.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ use linfa::{traits::Transformer, DatasetBase};
3838
/// The algorithm iterates over each point in the dataset and for every point
3939
/// not yet assigned to a cluster:
4040
/// - Find all points within the neighborhood of size `tolerance`
41-
/// - If the number of points in the neighborhood is below a minimum size label
42-
/// as noise
43-
/// - Otherwise label the point with the cluster ID and repeat with each of the
44-
/// neighbours
41+
/// - If the number of points in the neighborhood is below a minimum size label as noise
42+
/// - Otherwise label the point with the cluster ID and repeat with each of the neighbours
4543
///
4644
/// ## Tutorial
4745
///

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ impl<F: Float> GaussianMixtureModel<F> {
211211
self.means()
212212
}
213213

214+
#[allow(clippy::type_complexity)]
214215
fn estimate_gaussian_parameters<D: Data<Elem = F>>(
215216
observations: &ArrayBase<D, Ix2>,
216217
resp: &Array2<F>,
@@ -505,17 +506,15 @@ mod tests {
505506
}
506507

507508
pub struct MultivariateNormal {
508-
pub mean: Array1<f64>,
509-
pub covariance: Array2<f64>,
510-
/// Lower triangular matrix (Cholesky decomposition of the coviariance matrix)
509+
mean: Array1<f64>,
510+
/// Lower triangular matrix (Cholesky decomposition of the covariance matrix)
511511
lower: Array2<f64>,
512512
}
513513
impl MultivariateNormal {
514514
pub fn new(mean: &ArrayView1<f64>, covariance: &ArrayView2<f64>) -> LAResult<Self> {
515515
let lower = covariance.cholesky()?;
516516
Ok(MultivariateNormal {
517517
mean: mean.to_owned(),
518-
covariance: covariance.to_owned(),
519518
lower,
520519
})
521520
}

0 commit comments

Comments
 (0)