ThymeBoost package
Subpackages
Submodules
ThymeBoost.ThymeBoost module
ThymeBoost.cost_functions module
- ThymeBoost.cost_functions.calc_cost(time_series, prediction, c, regularization, global_cost)
- ThymeBoost.cost_functions.calc_entropy(actuals, predicted)
- ThymeBoost.cost_functions.calc_mae(actuals, predicted)
- ThymeBoost.cost_functions.calc_mape(actuals, predicted, epsilon=1e-08)
- ThymeBoost.cost_functions.calc_mse(actuals, predicted)
- ThymeBoost.cost_functions.calc_smape(actuals, predicted)
- ThymeBoost.cost_functions.get_split_cost(time_series, split1, split2, split_cost)
Calculate the cost for the given split point using binary segmentation.
- Parameters:
time_series (np.array) – The input time series.
split1 (np.array) – The first split of the binary segmentation.
split2 (np.array) – The second split of the binary segmentation..
split_cost (str) – The metric to use for calculating the cost.
- Raises:
ValueError – If the cost metric provided does not exist this error will be raised.
- Returns:
cost – The cost for the given split.
- Return type:
float
ThymeBoost.ensemble module
ThymeBoost.optimizer module
ThymeBoost.param_iterator module
A base class which is inherited by both ensemble and optimize classes. Used to clean large parameter lists of illegal combinations
- class ThymeBoost.param_iterator.ParamIterator
Bases:
objectThe ensemble/optimizer base class
- param_check(params)
Given a dict of params, check for illegal combinations
- Parameters:
params (dict) – A dictionary of params for one single thymeboost model.
- Returns:
params – A dictionary with illegal values nullified.
- Return type:
dict
- sanitize_params(param_list)
Iterate through param dicts to sanitize illegal combinations.
- Parameters:
param_list (list) – A List of param dicts.
- Returns:
List of cleaned param dicts.
- Return type:
list
ThymeBoost.predict_functions module
- ThymeBoost.predict_functions.predict_exogenous(booster_obj, future_exo, boosting_round, forecast_horizon)
Predict the exogenous component using the booster.
- Parameters:
boosting_round (int) – The round to reference when getting model params.
forecast_horizon (int) – Number of periods to forecast.
- Returns:
seas_round – That boosting round’s predicted seasonal component.
- Return type:
np.array
- ThymeBoost.predict_functions.predict_rounds(booster_obj, forecast_horizon, trend_penalty, future_exo=None, online_learning=False)
Predict all the rounds from a booster
- Parameters:
fitted_output (pd.DataFrame) – Output from fit method.
forecast_horizon (int) – Number of periods to forecast.
- Returns:
trend_predictions (np.array) – Trend component.
seasonal_predictions (np.array) – seasonal component.
predictions (np.array) – Predictions.
- ThymeBoost.predict_functions.predict_seasonality(booster_obj, boosting_round, forecast_horizon)
Predict the seasonality component using the booster.
- Parameters:
boosting_round (int) – The round to reference when getting model params.
forecast_horizon (int) – Number of periods to forecast.
- Returns:
seas_round – That boosting round’s predicted seasonal component.
- Return type:
np.array
- ThymeBoost.predict_functions.predict_trend(booster_obj, boosting_round, forecast_horizon, trend_penalty, online_learning)
Predict the trend component using the booster
- Parameters:
boosting_round (int) – The round to reference when getting model params.
forecast_horizon (int) – Number of periods to forecast.
- Returns:
trend_round – That boosting round’s predicted trend component.
- Return type:
np.array
ThymeBoost.split_proposals module
A class to propose splits according to the most and least interesting points based on the gradient.
- class ThymeBoost.split_proposals.SplitProposals(given_splits, exclude_splits, min_sample_pct, n_split_proposals, split_strategy, approximate_splits)
Bases:
objectGenerate splits to try when fit_type = ‘local’.
- Parameters:
given_splits (list) – Splits to use when using fit_type=’local’.
exclude_splits (list) – exclude these index when considering splits for fit_type=’local’. Must be idx not datetimeindex if using a Pandas Series.
min_sample_pct (float) – Percentage of samples required to consider a split. Must be 0<min_sample_pct<=1.
n_split_proposals (int) – Number of split proposals based on the gradients.
approximate_splits (boolean) – Whether to use proposal splits based on gradients or exhaustively try splits with at least min_sample_pct samples.
- Return type:
A list of splits to try.
- get_approximate_split_proposals()
Propose indices to split the data on.
- Returns:
proposals – The proposals to try out.
- Return type:
list
- get_split_proposals(time_series)
Get proposals based on simple gradient strategy or histograms.
- Parameters:
time_series (np.array) – The time series.
- Returns:
A list of split indices to try.
- Return type:
list
- gradient_based_proposal()
- histogram_based_proposal()
- set_proposal_method()