Skip to content

Commit 76d1ef6

Browse files
authored
Update Cargo.toml (#299)
* Update Cargo.toml * chore: fix clippy * chore: bump actions * chore: fix clippy * chore: update target name --------- Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
1 parent 4092e24 commit 76d1ef6

File tree

9 files changed

+17
-33
lines changed

9 files changed

+17
-33
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ jobs:
1919
{ os: "ubuntu", target: "i686-unknown-linux-gnu" },
2020
{ os: "ubuntu", target: "wasm32-unknown-unknown" },
2121
{ os: "macos", target: "aarch64-apple-darwin" },
22-
{ os: "ubuntu", target: "wasm32-wasi" },
2322
]
2423
env:
2524
TZ: "/usr/share/zoneinfo/your/location"
2625
steps:
27-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2827
- name: Cache .cargo and target
29-
uses: actions/cache@v2
28+
uses: actions/cache@v4
3029
with:
3130
path: |
3231
~/.cargo
@@ -36,16 +35,13 @@ jobs:
3635
- name: Install Rust toolchain
3736
uses: actions-rs/toolchain@v1
3837
with:
39-
toolchain: 1.81 # 1.82 seems to break wasm32 tests https://github.com/rustwasm/wasm-bindgen/issues/4274
38+
toolchain: stable
4039
target: ${{ matrix.platform.target }}
4140
profile: minimal
4241
default: true
4342
- name: Install test runner for wasm
4443
if: matrix.platform.target == 'wasm32-unknown-unknown'
4544
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
46-
- name: Install test runner for wasi
47-
if: matrix.platform.target == 'wasm32-wasi'
48-
run: curl https://wasmtime.dev/install.sh -sSf | bash
4945
- name: Stable Build with all features
5046
uses: actions-rs/cargo@v1
5147
with:
@@ -65,13 +61,7 @@ jobs:
6561
- name: Tests in WASM
6662
if: matrix.platform.target == 'wasm32-unknown-unknown'
6763
run: wasm-pack test --node -- --all-features
68-
- name: Tests in WASI
69-
if: matrix.platform.target == 'wasm32-wasi'
70-
run: |
71-
export WASMTIME_HOME="$HOME/.wasmtime"
72-
export PATH="$WASMTIME_HOME/bin:$PATH"
73-
cargo install cargo-wasi && cargo wasi test
74-
64+
7565
check_features:
7666
runs-on: "${{ matrix.platform.os }}-latest"
7767
strategy:
@@ -81,9 +71,9 @@ jobs:
8171
env:
8272
TZ: "/usr/share/zoneinfo/your/location"
8373
steps:
84-
- uses: actions/checkout@v3
74+
- uses: actions/checkout@v4
8575
- name: Cache .cargo and target
86-
uses: actions/cache@v2
76+
uses: actions/cache@v4
8777
with:
8878
path: |
8979
~/.cargo

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
env:
1313
TZ: "/usr/share/zoneinfo/your/location"
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Cache .cargo
17-
uses: actions/cache@v2
17+
uses: actions/cache@v4
1818
with:
1919
path: |
2020
~/.cargo

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: Cache .cargo and target
17-
uses: actions/cache@v2
17+
uses: actions/cache@v4
1818
with:
1919
path: |
2020
~/.cargo

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "smartcore"
33
description = "Machine Learning in Rust."
44
homepage = "https://smartcorelib.org"
5-
version = "0.4.0"
5+
version = "0.4.1"
66
authors = ["smartcore Developers"]
77
edition = "2021"
88
license = "Apache-2.0"

src/linalg/basic/matrix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ mod tests {
663663
#[test]
664664
fn test_instantiate_err_view3() {
665665
let x = DenseMatrix::from_2d_array(&[&[1., 2., 3.], &[4., 5., 6.], &[7., 8., 9.]]).unwrap();
666+
#[allow(clippy::reversed_empty_ranges)]
666667
let v = DenseMatrixView::new(&x, 0..3, 4..3);
667668
assert!(v.is_err());
668669
}

src/naive_bayes/bernoulli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ impl<TY: Number + Ord + Unsigned> BernoulliNBDistribution<TY> {
257257
/// Fits the distribution to a NxM matrix where N is number of samples and M is number of features.
258258
/// * `x` - training data.
259259
/// * `y` - vector with target values (classes) of length N.
260-
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined,
261-
/// priors are adjusted according to the data.
260+
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined, priors are adjusted according to the data.
262261
/// * `alpha` - Additive (Laplace/Lidstone) smoothing parameter.
263262
/// * `binarize` - Threshold for binarizing.
264263
fn fit<TX: Number + PartialOrd, X: Array2<TX>, Y: Array1<TY>>(

src/naive_bayes/gaussian.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ impl<TY: Number + Ord + Unsigned> GaussianNBDistribution<TY> {
174174
/// Fits the distribution to a NxM matrix where N is number of samples and M is number of features.
175175
/// * `x` - training data.
176176
/// * `y` - vector with target values (classes) of length N.
177-
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined,
178-
/// priors are adjusted according to the data.
177+
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined, priors are adjusted according to the data.
179178
pub fn fit<TX: Number + RealNumber, X: Array2<TX>, Y: Array1<TY>>(
180179
x: &X,
181180
y: &Y,

src/naive_bayes/multinomial.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ impl<TY: Number + Ord + Unsigned> MultinomialNBDistribution<TY> {
207207
/// Fits the distribution to a NxM matrix where N is number of samples and M is number of features.
208208
/// * `x` - training data.
209209
/// * `y` - vector with target values (classes) of length N.
210-
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined,
211-
/// priors are adjusted according to the data.
210+
/// * `priors` - Optional vector with prior probabilities of the classes. If not defined, priors are adjusted according to the data.
212211
/// * `alpha` - Additive (Laplace/Lidstone) smoothing parameter.
213212
pub fn fit<TX: Number + Unsigned, X: Array2<TX>, Y: Array1<TY>>(
214213
x: &X,

src/preprocessing/categorical.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
//! // &[1.5, 1.0, 0.0, 1.5, 0.0, 0.0, 1.0, 0.0]
2525
//! // &[1.5, 0.0, 1.0, 1.5, 0.0, 0.0, 0.0, 1.0]
2626
//! ```
27-
use std::iter;
27+
use std::iter::repeat_n;
2828

2929
use crate::error::Failed;
3030
use crate::linalg::basic::arrays::Array2;
@@ -75,11 +75,7 @@ fn find_new_idxs(num_params: usize, cat_sizes: &[usize], cat_idxs: &[usize]) ->
7575
let offset = (0..1).chain(offset_);
7676

7777
let new_param_idxs: Vec<usize> = (0..num_params)
78-
.zip(
79-
repeats
80-
.zip(offset)
81-
.flat_map(|(r, o)| iter::repeat(o).take(r)),
82-
)
78+
.zip(repeats.zip(offset).flat_map(|(r, o)| repeat_n(o, r)))
8379
.map(|(idx, ofst)| idx + ofst)
8480
.collect();
8581
new_param_idxs
@@ -124,7 +120,7 @@ impl OneHotEncoder {
124120
let (nrows, _) = data.shape();
125121

126122
// col buffer to avoid allocations
127-
let mut col_buf: Vec<T> = iter::repeat(T::zero()).take(nrows).collect();
123+
let mut col_buf: Vec<T> = repeat_n(T::zero(), nrows).collect();
128124

129125
let mut res: Vec<CategoryMapper<CategoricalFloat>> = Vec::with_capacity(idxs.len());
130126

0 commit comments

Comments
 (0)