prophet_regressor#

Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.

Module Contents#

Classes Summary#

ProphetRegressor

Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.

Contents#

class evalml.pipelines.components.estimators.regressors.prophet_regressor.ProphetRegressor(time_index: Optional[Hashable] = None, changepoint_prior_scale: float = 0.05, seasonality_prior_scale: int = 10, holidays_prior_scale: int = 10, seasonality_mode: str = 'additive', stan_backend: str = 'CMDSTANPY', interval_width: float = 0.95, random_seed: Union[int, float] = 0, **kwargs)[source]#

Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.

More information here: https://facebook.github.io/prophet/

Parameters
  • time_index (str) – Specifies the name of the column in X that provides the datetime objects. Defaults to None.

  • changepoint_prior_scale (float) – Determines the strength of the sparse prior for fitting on rate changes. Increasing this value increases the flexibility of the trend. Defaults to 0.05.

  • seasonality_prior_scale (int) – Similar to changepoint_prior_scale. Adjusts the extent to which the seasonality model will fit the data. Defaults to 10.

  • holidays_prior_scale (int) – Similar to changepoint_prior_scale. Adjusts the extent to which holidays will fit the data. Defaults to 10.

  • seasonality_mode (str) – Determines how this component fits the seasonality. Options are “additive” and “multiplicative”. Defaults to “additive”.

  • stan_backend (str) – Determines the backend that should be used to run Prophet. Options are “CMDSTANPY” and “PYSTAN”. Defaults to “CMDSTANPY”.

  • interval_width (float) – Determines the confidence of the prediction interval range when calling get_prediction_intervals. Accepts values in the range (0,1). Defaults to 0.95.

  • random_seed (int) – Seed for the random number generator. Defaults to 0.

Attributes

hyperparameter_ranges

{ “changepoint_prior_scale”: Real(0.001, 0.5), “seasonality_prior_scale”: Real(0.01, 10), “holidays_prior_scale”: Real(0.01, 10), “seasonality_mode”: [“additive”, “multiplicative”],}

model_family

ModelFamily.PROPHET

modifies_features

True

modifies_target

False

name

Prophet Regressor

supported_problem_types

[ProblemTypes.TIME_SERIES_REGRESSION]

training_only

False

Methods

build_prophet_df

Build the Prophet data to pass fit and predict on.

clone

Constructs a new component with the same parameters and random state.

default_parameters

Returns the default parameters for this component.

describe

Describe a component and its parameters.

feature_importance

Returns array of 0's with len(1) as feature_importance is not defined for Prophet regressor.

fit

Fits Prophet regressor component to data.

get_params

Get parameters for the Prophet regressor.

get_prediction_intervals

Find the prediction intervals using the fitted ProphetRegressor.

load

Loads component at file path.

needs_fitting

Returns boolean determining if component needs fitting before calling predict, predict_proba, transform, or feature_importances.

parameters

Returns the parameters which were used to initialize the component.

predict

Make predictions using fitted Prophet regressor.

predict_proba

Make probability estimates for labels.

save

Saves component at file path.

update_parameters

Updates the parameter dictionary of the component.

static build_prophet_df(X: pandas.DataFrame, y: Optional[pandas.Series] = None, time_index: str = 'ds') pandas.DataFrame[source]#

Build the Prophet data to pass fit and predict on.

clone(self)#

Constructs a new component with the same parameters and random state.

Returns

A new instance of this component with identical parameters and random state.

default_parameters(cls) dict#

Returns the default parameters for this component.

Returns

Default parameters for this component.

Return type

dict

describe(self, print_name=False, return_dict=False)#

Describe a component and its parameters.

Parameters
  • print_name (bool, optional) – whether to print name of component

  • return_dict (bool, optional) – whether to return description as dictionary in the format {“name”: name, “parameters”: parameters}

Returns

Returns dictionary if return_dict is True, else None.

Return type

None or dict

property feature_importance(self) numpy.ndarray#

Returns array of 0’s with len(1) as feature_importance is not defined for Prophet regressor.

fit(self, X: pandas.DataFrame, y: Optional[pandas.Series] = None)[source]#

Fits Prophet regressor component to data.

Parameters
  • X (pd.DataFrame) – The input training data of shape [n_samples, n_features].

  • y (pd.Series) – The target training data of length [n_samples].

Returns

self

get_params(self) dict[source]#

Get parameters for the Prophet regressor.

get_prediction_intervals(self, X: pandas.DataFrame, y: Optional[pandas.Series] = None, coverage: List[float] = None, predictions: pandas.Series = None) Dict[str, pandas.Series][source]#

Find the prediction intervals using the fitted ProphetRegressor.

Parameters
  • X (pd.DataFrame) – Data of shape [n_samples, n_features].

  • y (pd.Series) – Target data. Ignored.

  • coverage (List[float]) – A list of floats between the values 0 and 1 that the upper and lower bounds of the prediction interval should be calculated for.

  • predictions (pd.Series) – Not used for Prophet estimator.

Returns

Prediction intervals, keys are in the format {coverage}_lower or {coverage}_upper.

Return type

dict

static load(file_path)#

Loads component at file path.

Parameters

file_path (str) – Location to load file.

Returns

ComponentBase object

needs_fitting(self)#

Returns boolean determining if component needs fitting before calling predict, predict_proba, transform, or feature_importances.

This can be overridden to False for components that do not need to be fit or whose fit methods do nothing.

Returns

True.

property parameters(self)#

Returns the parameters which were used to initialize the component.

predict(self, X: pandas.DataFrame, y: Optional[pandas.Series] = None) pandas.Series[source]#

Make predictions using fitted Prophet regressor.

Parameters
  • X (pd.DataFrame) – Data of shape [n_samples, n_features].

  • y (pd.Series) – Target data. Ignored.

Returns

Predicted values.

Return type

pd.Series

predict_proba(self, X: pandas.DataFrame) pandas.Series#

Make probability estimates for labels.

Parameters

X (pd.DataFrame) – Features.

Returns

Probability estimates.

Return type

pd.Series

Raises

MethodPropertyNotFoundError – If estimator does not have a predict_proba method or a component_obj that implements predict_proba.

save(self, file_path, pickle_protocol=cloudpickle.DEFAULT_PROTOCOL)#

Saves component at file path.

Parameters
  • file_path (str) – Location to save file.

  • pickle_protocol (int) – The pickle data stream format.

update_parameters(self, update_dict, reset_fit=True)#

Updates the parameter dictionary of the component.

Parameters
  • update_dict (dict) – A dict of parameters to update.

  • reset_fit (bool, optional) – If True, will set _is_fitted to False.