Пример #1
0
 def test_prophet_kwargs_set_params(self):
     prophet_original_pars = {'n_changepoints': 10}
     m = SkProphet(prophet_kwargs=prophet_original_pars)
     prophet_new_pars = {
         'prophet_kwargs': {
             'yearly_seasonality': 4
         },
         'n_changepoints': 2,
     }
     m.set_params(**prophet_new_pars)
     expected_prophet_kwargs = {
         'yearly_seasonality': 4,
         'n_changepoints': 2
     }
     self.assertEqual(m.prophet_kwargs, expected_prophet_kwargs)
     self.assertEqual(m.yearly_seasonality, 4)
     self.assertEqual(m.n_changepoints, 2)
Пример #2
0
 def test_set_params(self):
     sk_date_column = 'ds'
     sk_yhat_only = True
     sk_extra_regressors = [dict(name='x', mode='multiplicative')]
     prophet_kwargs = {'daily_seasonality': True}
     p = SkProphet(sk_date_column, sk_yhat_only, sk_extra_regressors,
                   prophet_kwargs)
     # Alternative params
     alternative_params = {
         'sk_date_column': 'date',
         'sk_extra_regressors': [dict(name='z')],
     }
     new_params = p.get_params(deep=True)
     new_params.update(alternative_params)
     # Assert params
     p.set_params(**new_params)
     params = p.get_params(deep=False)
     self.assertEqual(new_params, params)
     self.assertEqual(p.sk_date_column, 'date')
     self.assertEqual(len(p.sk_extra_regressors), 1)
     self.assertEqual(p.sk_extra_regressors[0]['name'], 'z')