hcrystalball.model_selection Package


add_model_to_gridsearch(model, grid_search)

Extends gridsearch with provided model.

filter_data(df[, include_rules, exclude_rules])

Filter provided dataframe by {column:value} rules.

get_gridsearch(frequency[, horizon, …])

Get grid search object based on selection criteria.


Load information about stored model selection

partition_data(df, partition_by)

Partition data by values found in one or more columns.

partition_data_by_values(df, column, …[, …])

Partition data by one column and a fixed set ov values within that column.

prepare_data_for_training(df, frequency, …)

Prepare data for model selection.

run_model_selection(df, grid_search, …[, …])

Run parallel cross validation on data and select best model

select_model(df, target_col_name, …[, …])

Find the best model from grid_search for each partition

select_model_general(df, grid_search, …[, …])

Run cross validation on data and select best model

get_best_not_failing_model(grid_search, X, y)

Prevent situation when model incompatible data are not seen during CV (in the last split of actuals) and model which cannot be fitted on the full dataset is choseen.


FinerTimeSplit([n_splits, horizon, …])

Time series cross-validator.

ModelSelector(horizon, frequency[, …])

Enable large scale cross validation easily accessible.

ModelSelectorResult(best_model, cv_results, …)

Consolidate infromation/methods from cross validation for 1 time series


load_best_model(*[, expert_type, …])

Returns unpickled file or json metadata from directory.

load_model_selector_result(*[, expert_type, …])

Returns unpickled file or json metadata from directory.

hcrystalball.wrappers Package


get_sklearn_wrapper(model_cls, **model_params)

Factory function returning the model specific SklearnWrapper with provided model_cls parameters.


ProphetWrapper([growth, changepoints, …])

Wrapper for prophet.Prophet model

ExponentialSmoothingWrapper([endog, trend, …])

Wrapper for ExponentialSmoothing (see other parameters there)

SimpleSmoothingWrapper([endog, …])

Wrapper for SimpleExpSmoothing (see other parameters there)

HoltSmoothingWrapper([endog, exponential, …])

Wrapper for Holt (see other parameters there)

ThetaWrapper([endog, period, deseasonalize, …])

Wrapper for ThetaModel (see other parameters there)

SarimaxWrapper([order, seasonal_order, …])

Wrapper for ARIMA and AutoARIMA

TBATSWrapper([use_box_cox, box_cox_bounds, …])

Wrapper for TBATS model

BATSWrapper([use_box_cox, box_cox_bounds, …])

Wrapper for BATS model

hcrystalball.ensemble Package


SimpleEnsemble(base_learners[, …])

SimpleEnsemble model, which takes a list of any hcrystalball model wrapper instance(s) as base learners and aggregates their prediction using ensemble_func.

StackingEnsemble(base_learners, meta_model)

StackingEnsemble model, which takes a list of any hcrystalball model wrapper instance(s) as base learners.

hcrystalball.feature_extraction Package


HolidayTransformer([country_code, …])

Generate holiday feature based on provided ISO code

SeasonalityTransformer([auto, freq, …])

Generate seasonal feature columns using one-hot encoding.

hcrystalball.compose Package


TSColumnTransformer(transformers, *[, …])

Time Series compatible ColumnTransformer.

hcrystalball.preprocessing Package


TargetTransformer(estimator, y_transformer)

Enable transformation of the target.

hcrystalball.metrics Package



Get a scorer supporting storing data for gridsearch from string.

make_ts_scorer(score_func[, …])

Make a scorer from a performance metric or loss function.

hcrystalball.utils Module


get_estimator_repr(model[, n_char_max])

Get the string representation of a model

get_sales_data([n_dates, n_assortments, …])

Load subset of Rossmann store sales dataset.


Generate a unique hash for a model using its string representation

generate_multiple_tsdata([n_dates, …])

Provide easy way how to generate dummy data for tests or tutorial purposes


Generate a unique hash for data partition

generate_tsdata([n_dates, random_state])

Generate dummy daily time series data compatible with hcrystalball API.

optional_import(module_path, class_name, …)

Imports optional dependencies.