Skip to content

Commit

Permalink
add heart_disease.csv to repo, fix seeded monitors in test
Browse files Browse the repository at this point in the history
  • Loading branch information
deciduously committed Jan 28, 2022
1 parent 0078de8 commit 775c9f3
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/app/core/monitor_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ mod test {
.await
.unwrap();
app.commit_transaction(txn).await.unwrap();
dbg!(&all_alerts);
assert_eq!(all_alerts.len(), 1);

// Scroll to one day, check that daily alert is created
Expand Down
10 changes: 5 additions & 5 deletions crates/app/core/test_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub async fn init_heart_disease_model(app: &App) -> Result<Id> {
pub async fn seed_events(app: &App, examples_count: usize, model_id: Id) -> Result<()> {
let target = "diagnosis";
let class_names = Some(&["Negative", "Positive"]);
let data_path = workspace_root().join("data").join("heart_disease.csv");
let data_path = workspace_root().join("heart_disease.csv");
let table = tangram_table::Table::from_path(&data_path, Default::default(), &mut |_| {})?;
let mut idx = 0;
let events: Vec<MonitorEvent> = (0..examples_count)
Expand Down Expand Up @@ -231,7 +231,7 @@ enum Diagnosis {
}
/// Returns the ID of the prediction as well as the predicted value
pub async fn seed_single_prediction_event(app: &App, model_id: Id) -> Result<(Id, String)> {
let data_path = workspace_root().join("data").join("heart_disease.csv");
let data_path = workspace_root().join("heart_disease.csv");
let table = tangram_table::Table::from_path(&data_path, Default::default(), &mut |_| {})?;

let id = Id::generate();
Expand Down Expand Up @@ -366,8 +366,8 @@ pub async fn seed_monitors(app: &App, model_id: Id) -> Result<()> {
threshold: MonitorThreshold {
metric: AlertMetric::Accuracy,
mode: MonitorThresholdMode::Absolute,
difference_lower: Some(0.5),
difference_upper: Some(0.5),
difference_lower: Some(0.1),
difference_upper: Some(0.1),
},
title: None,
},
Expand All @@ -376,7 +376,7 @@ pub async fn seed_monitors(app: &App, model_id: Id) -> Result<()> {
threshold: MonitorThreshold {
metric: AlertMetric::Accuracy,
mode: MonitorThresholdMode::Percentage,
difference_lower: Some(0.3),
difference_lower: Some(20.0),
difference_upper: None,
},
title: None,
Expand Down
2 changes: 1 addition & 1 deletion crates/app/seed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct DatasetConfig {
}

const HEART_DISEASE: DatasetConfig = DatasetConfig {
path: "data/heart_disease.csv",
path: "heart_disease.csv",
model_path: "heart_disease.tangram",
name: "heart_disease",
target: "diagnosis",
Expand Down
Loading

0 comments on commit 775c9f3

Please sign in to comment.