Skip to content

Commit

Permalink
Update metrics test to handle zero values.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasChia committed May 4, 2024
1 parent 03d5bfa commit fb07236
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/prophet/tests/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ def test_performance_metrics(self, ts_short, backend):
metrics=["coverage", "mse"],
)
assert set(df_horizon.columns) == {"coverage", "mse", "horizon"}
# Skip MAPE
df_cv.loc[0, "y"] = 0.0
# Handle zero y and yhat and skip MAPE
df_cv["y"] = 0.0
df_cv["yhat"] = 0.0
df_horizon = diagnostics.performance_metrics(
df_cv,
metrics=["coverage", "mape"],
)
assert set(df_horizon.columns) == {"coverage", "horizon"}
assert set(df_horizon.columns) == {"coverage", "horizon", "mae", "mdape", "mse", "rmse", "smape"}
df_horizon = diagnostics.performance_metrics(
df_cv,
metrics=["mape"],
Expand Down

0 comments on commit fb07236

Please sign in to comment.