Optional dependencies not failing on import
MichalChromcak opened this issue · 0 comments
MichalChromcak commented
When using minimal pip install hcrystalball
installation and trying to run following code with prophet
, expected behavior is import error for prophet wrapper
import pandas as pd
from hcrystalball.model_selection import ModelSelector
from hcrystalball.utils import get_sales_data
df = get_sales_data(n_dates=100,
n_assortments=2,
n_states=2,
n_stores=2)
ms = ModelSelector(horizon=10,
frequency='D',
country_code_column='HolidayCode',
)
ms.create_gridsearch(sklearn_models=True,
prophet_models=True,
n_splits = 2,
between_split_lag=None,
sklearn_models_optimize_for_horizon=False,
autosarimax_models=False,
tbats_models=False,
exp_smooth_models=False,
average_ensembles=False,
stacking_ensembles=False,
exog_cols=['Open','Promo','SchoolHoliday','Promo2'],
)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-3c1b160302bf> in <module>
----> 1 ms.create_gridsearch(sklearn_models=True,
2 n_splits = 2,
3 between_split_lag=None,
4 sklearn_models_optimize_for_horizon=False,
5 autosarimax_models=False,
~/miniconda3/envs/hcb_conda/lib/python3.8/site-packages/hcrystalball/model_selection/_model_selector.py in create_gridsearch(self, n_splits, between_split_lag, scoring, country_code_column, country_code, sklearn_models, sklearn_models_optimize_for_horizon, autosarimax_models, autoarima_dict, prophet_models, tbats_models, exp_smooth_models, average_ensembles, stacking_ensembles, stacking_ensembles_train_horizon, stacking_ensembles_train_n_splits, clip_predictions_lower, clip_predictions_upper, exog_cols)
234 """
235 params = {k: v for k, v in locals().items() if k not in ["self"]}
--> 236 self.grid_search = get_gridsearch(frequency=self.frequency, horizon=self.horizon, **params)
237
238 def add_model_to_gridsearch(self, model):
~/miniconda3/envs/hcb_conda/lib/python3.8/site-packages/hcrystalball/model_selection/_configuration.py in get_gridsearch(frequency, horizon, n_splits, between_split_lag, scoring, country_code_column, country_code, sklearn_models, sklearn_models_optimize_for_horizon, autosarimax_models, autoarima_dict, prophet_models, tbats_models, exp_smooth_models, average_ensembles, stacking_ensembles, stacking_ensembles_train_horizon, stacking_ensembles_train_n_splits, clip_predictions_lower, clip_predictions_upper, exog_cols)
227 {
228 "model": [
--> 229 ProphetWrapper(
230 clip_predictions_lower=clip_predictions_lower,
231 clip_predictions_upper=clip_predictions_upper,
TypeError: __init__() got an unexpected keyword argument 'clip_predictions_lower'