Skip to content

Commit c79d3e8

Browse files
committed
uncomment test
1 parent d52830a commit c79d3e8

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

src/linalg/basic/vector.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl<T: Debug + Display + Copy + Sized> Array<T, usize> for Vec<T> {
3636

3737
impl<T: Debug + Display + Copy + Sized> MutArray<T, usize> for Vec<T> {
3838
fn set(&mut self, i: usize, x: T) {
39+
// NOTE: this panics in case of out of bounds index
3940
self[i] = x
4041
}
4142

src/linear/logistic_regression.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -818,37 +818,37 @@ mod tests {
818818
assert!(reg_coeff_sum < coeff);
819819
}
820820

821-
// TODO: serialization for the new DenseMatrix needs to be implemented
822-
// #[cfg_attr(all(target_arch = "wasm32", not(target_os = "wasi")), wasm_bindgen_test::wasm_bindgen_test)]
823-
// #[test]
824-
// #[cfg(feature = "serde")]
825-
// fn serde() {
826-
// let x = DenseMatrix::from_2d_array(&[
827-
// &[1., -5.],
828-
// &[2., 5.],
829-
// &[3., -2.],
830-
// &[1., 2.],
831-
// &[2., 0.],
832-
// &[6., -5.],
833-
// &[7., 5.],
834-
// &[6., -2.],
835-
// &[7., 2.],
836-
// &[6., 0.],
837-
// &[8., -5.],
838-
// &[9., 5.],
839-
// &[10., -2.],
840-
// &[8., 2.],
841-
// &[9., 0.],
842-
// ]);
843-
// let y: Vec<i32> = vec![0, 0, 1, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 1];
844-
845-
// let lr = LogisticRegression::fit(&x, &y, Default::default()).unwrap();
846-
847-
// let deserialized_lr: LogisticRegression<f64, i32, DenseMatrix<f64>, Vec<i32>> =
848-
// serde_json::from_str(&serde_json::to_string(&lr).unwrap()).unwrap();
849-
850-
// assert_eq!(lr, deserialized_lr);
851-
// }
821+
//TODO: serialization for the new DenseMatrix needs to be implemented
822+
#[cfg_attr(all(target_arch = "wasm32", not(target_os = "wasi")), wasm_bindgen_test::wasm_bindgen_test)]
823+
#[test]
824+
#[cfg(feature = "serde")]
825+
fn serde() {
826+
let x = DenseMatrix::from_2d_array(&[
827+
&[1., -5.],
828+
&[2., 5.],
829+
&[3., -2.],
830+
&[1., 2.],
831+
&[2., 0.],
832+
&[6., -5.],
833+
&[7., 5.],
834+
&[6., -2.],
835+
&[7., 2.],
836+
&[6., 0.],
837+
&[8., -5.],
838+
&[9., 5.],
839+
&[10., -2.],
840+
&[8., 2.],
841+
&[9., 0.],
842+
]);
843+
let y: Vec<i32> = vec![0, 0, 1, 1, 2, 1, 1, 0, 0, 2, 1, 1, 0, 0, 1];
844+
845+
let lr = LogisticRegression::fit(&x, &y, Default::default()).unwrap();
846+
847+
let deserialized_lr: LogisticRegression<f64, i32, DenseMatrix<f64>, Vec<i32>> =
848+
serde_json::from_str(&serde_json::to_string(&lr).unwrap()).unwrap();
849+
850+
assert_eq!(lr, deserialized_lr);
851+
}
852852

853853
#[cfg_attr(
854854
all(target_arch = "wasm32", not(target_os = "wasi")),

0 commit comments

Comments
 (0)