-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Prophet.resample_time_stamps bug (#112)
* add unit test for Prophet.resample_time_stamps test failing at this commit because of the bug * fix bug in Prophet.resample_time_stamps
- Loading branch information
1 parent
e0a79f0
commit 7047d12
Showing
2 changed files
with
24 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import unittest | ||
|
||
import pandas as pd | ||
import numpy as np | ||
|
||
from merlion.models.forecast.prophet import Prophet, ProphetConfig | ||
from merlion.utils.resample import to_timestamp | ||
|
||
|
||
class TestProphet(unittest.TestCase): | ||
def test_resample_time_stamps(self): | ||
# arrange | ||
config = ProphetConfig() | ||
prophet = Prophet(config) | ||
prophet.last_train_time = pd._libs.tslibs.timestamps.Timestamp(year=2022, month=1, day=1) | ||
prophet.timedelta = pd._libs.tslibs.timedeltas.Timedelta(days=1) | ||
target = np.array([to_timestamp(pd._libs.tslibs.timestamps.Timestamp(year=2022, month=1, day=2))]) | ||
|
||
# act | ||
output = prophet.resample_time_stamps(time_stamps=1) | ||
|
||
# assert | ||
assert output == target |