This repository has been archived by the owner on May 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: parallel training to disk (#492)
- Loading branch information
Showing
6 changed files
with
100 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from pathlib import Path | ||
|
||
import pandas as pd | ||
from psycop_model_training.application_modules.train_model.main import train_model | ||
from psycop_model_training.config_schemas.full_config import FullConfigSchema | ||
|
||
|
||
def test_saving_results_to_parquet( | ||
muteable_test_config: FullConfigSchema, | ||
tmp_path: Path, | ||
): | ||
"""Test that model performance is saved to a parquet file for querying.""" | ||
cfg = muteable_test_config | ||
|
||
for _ in [0, 1]: | ||
# Run twice to ensure that we can also append to a file | ||
train_model(cfg, override_output_dir=tmp_path / "run_eval") | ||
|
||
run_performance_path = list(tmp_path.glob(r"*.parquet"))[0] | ||
run_performance_df = pd.read_parquet(run_performance_path) | ||
|
||
for info in ["run_name", "roc_auc", "timestamp", "lookahead_days", "model_name"]: | ||
assert info in run_performance_df.columns | ||
|
||
assert len(run_performance_df["run_name"].unique()) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters