Skip to content

Commit

Permalink
add a test that confirms prophet detector error with irregular data
Browse files Browse the repository at this point in the history
Summary: prophet detectors are failing to train when data is irregular

Reviewed By: yazovskymeta

Differential Revision: D67392498

fbshipit-source-id: cbd4904a9761fb129322142314930e0821d4f917
  • Loading branch information
islijepcevic authored and facebook-github-bot committed Dec 18, 2024
1 parent 26160ad commit 2691011
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions kats/tests/detectors/test_prophet_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,41 @@ def test_outlier_removal_efficacy(
"Expected removing outliers when training model to lower prediction RMSE",
)

# pyre-fixme[56]: Pyre was not able to infer the type of the decorator `parameter...
@parameterized.expand([[0.01], [1.0], [1000000.0]])
def test_irregular_data_intervals(self, data_multiplier: float) -> None:
irregular_ts = TimeSeriesData(
time=pd.DatetimeIndex(
[
pd.Timestamp("2024-12-02 15:00:00"),
pd.Timestamp("2024-12-02 16:00:00"),
pd.Timestamp("2024-12-02 17:00:00"),
pd.Timestamp("2024-12-04 21:10:00"),
pd.Timestamp("2024-12-04 21:30:00"),
pd.Timestamp("2024-12-08 23:30:00"),
pd.Timestamp("2024-12-09 00:10:00"),
pd.Timestamp("2024-12-09 00:40:00"),
]
),
value=pd.Series(
[
3.5,
3.9,
4.1,
5.1,
5.2,
4.4,
4.0,
3.7,
]
)
* data_multiplier,
)

model = ProphetDetectorModel(remove_outliers=True)
with self.assertRaises(ValueError):
model.fit(irregular_ts)

def test_default_score_func(self) -> None:
"""Test that 'deviation_from_predicted_val' is used by default
Expand Down

0 comments on commit 2691011

Please sign in to comment.