Skip to content

Commit

Permalink
Update names for stats dict
Browse files Browse the repository at this point in the history
  • Loading branch information
aalexmmaldonado committed Aug 22, 2024
1 parent 7485556 commit 4e5dd1a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions docs/commands/analyze.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ The `analyze` command will generate a JSON file (default name: `analysis.json`)

```json
{
"baseline_stats": {
"baseline": {
"degrees_of_freedom": int,
"average_temp": float,
"std_dev_temp": float,
"max_temp": float,
"min_temp": float,
"residual_sum_squares": float
},
"residual_stats": {
"residual": {
"max_residual": float,
"residual_lower_bound": float,
"residual_upper_bound": float
},
"duration_stats": {
"duration": {
"total_duration_hours": float,
"fever_hours": int,
"hypothermia_hours": int
Expand Down
18 changes: 9 additions & 9 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ def test_get_all_stats(example_forecast_df, baseline_hours):
pred_column="y_hat",
residual_column="residual",
)
assert results["baseline_stats"]["degrees_of_freedom"] == 2721
assert np.allclose(results["baseline_stats"]["average_temp"], 37.89085)
assert np.allclose(results["baseline_stats"]["std_dev_temp"], 0.70588941)
assert np.allclose(results["baseline_stats"]["residual_sum_squares"], 1911.0984)
assert np.allclose(results["residual_stats"]["max_residual"], 2.70556)
assert np.allclose(results["residual_stats"]["residual_upper_bound"], 0.264615542)
assert np.allclose(results["duration_stats"]["total_duration_hours"], 693.210555)
assert results["duration_stats"]["fever_hours"] == 261
assert results["duration_stats"]["hypothermia_hours"] == 157
assert results["baseline"]["degrees_of_freedom"] == 2721
assert np.allclose(results["baseline"]["average_temp"], 37.89085)
assert np.allclose(results["baseline"]["std_dev_temp"], 0.70588941)
assert np.allclose(results["baseline"]["residual_sum_squares"], 1911.0984)
assert np.allclose(results["residual"]["max_residual"], 2.70556)
assert np.allclose(results["residual"]["residual_upper_bound"], 0.264615542)
assert np.allclose(results["duration"]["total_duration_hours"], 693.210555)
assert results["duration"]["fever_hours"] == 261
assert results["duration"]["hypothermia_hours"] == 157
6 changes: 3 additions & 3 deletions vaxstats/analysis/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def run_analysis(

# Combine all statistics into a single dictionary
stats_dict = {
"baseline_stats": baseline_stats,
"residual_stats": residual_stats,
"duration_stats": duration_stats,
"baseline": baseline_stats,
"residual": residual_stats,
"duration": duration_stats,
}

return stats_dict
Expand Down

0 comments on commit 4e5dd1a

Please sign in to comment.