Skip to content

Commit

Permalink
Fixes for test instability
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeMe committed Apr 2, 2023
1 parent 0b89bf8 commit 295aaa3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
jobs:
check:
name: Check
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -24,7 +24,7 @@ jobs:

test:
name: Test Suite
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -40,7 +40,7 @@ jobs:

fmt:
name: Rustfmt
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -58,7 +58,7 @@ jobs:

clippy:
name: Clippy
runs-on: ubuntu-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
Expand Down
18 changes: 8 additions & 10 deletions crates/liblinear/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,7 @@ fn test_cross_validator() {
.iter()
.map(|e| *e as i32)
.collect::<Vec<i32>>();

// RHS was taken from the output of liblinear's bundled trainer program
assert_abs_diff_eq!(
categorical_accuracy(&predicted, &ground_truth).unwrap(),
0.8148148
);

let pred_acc = categorical_accuracy(&predicted, &ground_truth).unwrap();
let (best_c, acc, best_p) =
Model::find_optimal_constraints_violation_cost_and_loss_sensitivity(
&libsvm_data,
Expand All @@ -211,9 +205,13 @@ fn test_cross_validator() {
-1.0,
)
.expect("couldn't perform parameter search");
// dbg!(best_c);
// dbg!(acc);
// dbg!(best_p);
dbg!(pred_acc);
dbg!(best_c);
dbg!(acc);
dbg!(best_p);

// RHS was taken from the output of liblinear's bundled trainer program
assert_abs_diff_eq!(pred_acc, 0.8148148);
assert_abs_diff_eq!(best_c, 0.125);
assert_abs_diff_eq!(acc, 0.8407407407407408);
assert_eq!(best_p, -1f64);
Expand Down

0 comments on commit 295aaa3

Please sign in to comment.