orbit.models package¶
Submodules¶
orbit.models.base_model module¶
orbit.models.dlt module¶
-
class
orbit.models.dlt.
BaseDLT
(regressor_col=None, regressor_sign=None, regressor_beta_prior=None, regressor_sigma_prior=None, regression_penalty='fixed_ridge', lasso_scale=0.5, auto_ridge_scale=0.5, slope_sm_input=None, period=1, damped_factor=0.8, global_trend_option='linear', **kwargs)¶ Bases:
orbit.models.ets.BaseETS
Base DLT model object with shared functionality for Full, Aggregated, and MAP methods
The model arguments are the same as BaseLGT with some additional arguments
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
period (int) – Used to set time_delta as 1 / max(period, seasonality). If None and no seasonality, then time_delta == 1
damped_factor (float) – Hyperparameter float value between [0, 1]. A smaller value further dampens the previous global trend value. Default, 0.8
global_trend_option ({ 'flat', 'linear', 'loglinear', 'logistic' }) – Transformation function for the shape of the forecasted global trend.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
-
class
orbit.models.dlt.
DLTAggregated
(**kwargs)¶ Bases:
orbit.models.ets.ETSAggregated
,orbit.models.dlt.BaseDLT
Concrete DLT model for aggregated posterior prediction
The model arguments are the same as ETSAggregated with some additional arguments
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
period (int) – Used to set time_delta as 1 / max(period, seasonality). If None and no seasonality, then time_delta == 1
damped_factor (float) – Hyperparameter float value between [0, 1]. A smaller value further dampens the previous global trend value. Default, 0.8
global_trend_option ({ 'flat', 'linear', 'loglinear', 'logistic' }) – Transformation function for the shape of the forecasted global trend.
aggregate_method ({ 'mean', 'median' }) – Method used to reduce parameter posterior samples
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
aggregate_method – Method used to reduce parameter posterior samples
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
See also
- class
~orbit.model.ets.BaseETS
orbit.models.ets.ETSAggregated
-
get_regression_coefs
()¶
-
class
orbit.models.dlt.
DLTFull
(**kwargs)¶ Bases:
orbit.models.ets.ETSFull
,orbit.models.dlt.BaseDLT
Concrete DLT model for full prediction
The model arguments are the same as ETSFull with some additional arguments
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
period (int) – Used to set time_delta as 1 / max(period, seasonality). If None and no seasonality, then time_delta == 1
damped_factor (float) – Hyperparameter float value between [0, 1]. A smaller value further dampens the previous global trend value. Default, 0.8
global_trend_option ({ 'flat', 'linear', 'loglinear', 'logistic' }) – Transformation function for the shape of the forecasted global trend.
n_bootstrap_draws (int) – Number of bootstrap samples to draw from the initial MCMC or VI posterior samples. If None, use the original posterior draws.
prediction_percentiles (list) – List of integers of prediction percentiles that should be returned on prediction. To avoid reporting any confident intervals, pass an empty list
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
n_bootstrap_draws – Number of bootstrap samples to draw from the initial MCMC or VI posterior samples. If None, use the original posterior draws.
prediction_percentiles – List of integers of prediction percentiles that should be returned on prediction. To avoid reporting any confident intervals, pass an empty list
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
See also
- class
~orbit.model.ets.BaseETS
orbit.models.ets.ETSFull
-
get_regression_coefs
(aggregate_method='mean')¶
-
class
orbit.models.dlt.
DLTMAP
(**kwargs)¶ Bases:
orbit.models.ets.ETSMAP
,orbit.models.dlt.BaseDLT
Concrete DLT model for MAP (Maximum a Posteriori) prediction
The model arguments are the same as ETSMAP with some additional arguments
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
period (int) – Used to set time_delta as 1 / max(period, seasonality). If None and no seasonality, then time_delta == 1
damped_factor (float) – Hyperparameter float value between [0, 1]. A smaller value further dampens the previous global trend value. Default, 0.8
global_trend_option ({ 'flat', 'linear', 'loglinear', 'logistic' }) – Transformation function for the shape of the forecasted global trend.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
See also
- class
~orbit.model.ets.BaseETS
orbit.models.ets.ETSMAP
-
get_regression_coefs
()¶
orbit.models.lgt module¶
-
class
orbit.models.lgt.
BaseLGT
(regressor_col=None, regressor_sign=None, regressor_beta_prior=None, regressor_sigma_prior=None, regression_penalty='fixed_ridge', lasso_scale=0.5, auto_ridge_scale=0.5, slope_sm_input=None, **kwargs)¶ Bases:
orbit.models.ets.BaseETS
Base LGT model object with shared functionality for Full, Aggregated, and MAP methods
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
-
class
orbit.models.lgt.
LGTAggregated
(**kwargs)¶ Bases:
orbit.models.lgt.BaseLGT
,orbit.models.ets.ETSAggregated
Concrete LGT model for aggregated posterior prediction
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
aggregate_method ({ 'mean', 'median' }) – Method used to reduce parameter posterior samples
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
aggregate_method – Method used to reduce parameter posterior samples
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
-
get_regression_coefs
()¶
-
class
orbit.models.lgt.
LGTFull
(**kwargs)¶ Bases:
orbit.models.lgt.BaseLGT
,orbit.models.ets.ETSFull
Concrete LGT model for full Bayesian prediction
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
n_bootstrap_draws (int) – Number of bootstrap samples to draw from the initial MCMC or VI posterior samples. If None, use the original posterior draws.
prediction_percentiles (list) – List of integers of prediction percentiles that should be returned on prediction. To avoid reporting any confident intervals, pass an empty list
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
n_bootstrap_draws – Number of bootstrap samples to draw from the initial MCMC or VI posterior samples. If None, use the original posterior draws.
prediction_percentiles – List of integers of prediction percentiles that should be returned on prediction. To avoid reporting any confident intervals, pass an empty list
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
seasonality – Length of seasonality
seasonality_sm_input – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
-
get_regression_coefs
(aggregate_method='mean')¶
-
class
orbit.models.lgt.
LGTMAP
(regressor_col=None, regressor_sign=None, regressor_beta_prior=None, regressor_sigma_prior=None, regression_penalty='fixed_ridge', lasso_scale=0.5, auto_ridge_scale=0.5, slope_sm_input=None, **kwargs)¶ Bases:
orbit.models.lgt.BaseLGT
,orbit.models.ets.ETSMAP
Concrete LGT model for MAP (Maximum a Posteriori) prediction
Similar to :class: ~orbit.models.LGTAggregated but prediction is based on Maximum a Posteriori (aka Mode) of the posterior.
This model only supports MAP estimating `estimator_type`s
- Parameters
response_col (str) – Name of response variable column, default ‘y’
date_col (str) – Name of date variable column, default ‘ds’
estimator_type (orbit.BaseEstimator) – Any subclass of orbit.BaseEstimator
seasonality (int) – Length of seasonality
seasonality_sm_input (float) – float value between [0, 1], applicable only if seasonality > 1. A larger value puts more weight on the current seasonality. If None, the model will estimate this value.
level_sm_input (float) – float value between [0.0001, 1]. A larger value puts more weight on the current level. If None, the model will estimate this value.
regressor_col (list) – Names of regressor columns, if any
regressor_sign (list) – list with values { ‘+’, ‘-‘, ‘=’ } such that ‘+’ indicates regressor coefficient estimates are constrained to [0, inf). ‘-‘ indicates regressor coefficient estimates are constrained to (-inf, 0]. ‘=’ indicates regressor coefficient estimates can be any value between (-inf, inf). The length of regressor_sign must be the same length as regressor_col. If None, all elements of list will be set to ‘=’.
regressor_beta_prior (list) – list of prior float values for regressor coefficient betas. The length of regressor_beta_prior must be the same length as regressor_col. If None, use non-informative priors.
regressor_sigma_prior (list) – list of prior float values for regressor coefficient sigmas. The length of regressor_sigma_prior must be the same length as regressor_col. If None, use non-informative priors.
regression_penalty ({ 'fixed_ridge', 'lasso', 'auto_ridge' }) – regression penalty method
lasso_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘lasso’
auto_ridge_scale (float) – float value between [0, 1], applicable only if regression_penalty == ‘auto_ridge’
slope_sm_input (float) – float value between [0, 1]. A larger value puts more weight on the current slope. If None, the model will estimate this value.
- Other Parameters
**kwargs (additional arguments passed into orbit.estimators.stan_estimator or orbit.estimators.pyro_estimator)
-
get_regression_coefs
()¶