mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-05-17 21:10:45 +00:00
Add test for deserialize backwards compatibility
This commit is contained in:
parent
40c5b84784
commit
0d0f508cf1
2 changed files with 20 additions and 0 deletions
1
python/fbprophet/tests/serialized_model_v0.6.1.dev0.json
Normal file
1
python/fbprophet/tests/serialized_model_v0.6.1.dev0.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -137,3 +137,22 @@ class TestSerialize(TestCase):
|
|||
fcst2 = m2.predict(test)
|
||||
|
||||
self.assertTrue(np.array_equal(fcst['yhat'].values, fcst2['yhat'].values))
|
||||
|
||||
def test_backwards_compatibility(self):
|
||||
old_versions = {
|
||||
'0.6.1.dev0': 29.3669923968994,
|
||||
}
|
||||
for v, pred_val in old_versions.items():
|
||||
fname = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'serialized_model_v{}.json'.format(v)
|
||||
)
|
||||
with open(fname, 'r') as fin:
|
||||
model_str = json.load(fin)
|
||||
# Check that deserializes
|
||||
m = model_from_json(model_str)
|
||||
self.assertEqual(json.loads(model_str)['__fbprophet_version'], v)
|
||||
# Predict
|
||||
future = m.make_future_dataframe(10)
|
||||
fcst = m.predict(future)
|
||||
self.assertAlmostEqual(fcst['yhat'].values[-1], pred_val)
|
||||
|
|
|
|||
Loading…
Reference in a new issue