MCPcopy
hub / github.com/facebook/prophet / calculate_initial_params

Method calculate_initial_params

python/prophet/forecaster.py:1169–1189  ·  view source on GitHub ↗

Calculates initial parameters for the model based on the preprocessed history. Parameters ---------- num_total_regressors: the count of seasonality fourier components plus holidays plus extra regressors.

(self, num_total_regressors: int)

Source from the content-addressed store, hash-verified

1167 )
1168
1169 def calculate_initial_params(self, num_total_regressors: int) -> ModelParams:
1170 """
1171 Calculates initial parameters for the model based on the preprocessed history.
1172
1173 Parameters
1174 ----------
1175 num_total_regressors: the count of seasonality fourier components plus holidays plus extra regressors.
1176 """
1177 if self.growth == 'linear':
1178 k, m = self.linear_growth_init(self.history)
1179 elif self.growth == 'flat':
1180 k, m = self.flat_growth_init(self.history)
1181 elif self.growth == 'logistic':
1182 k, m = self.logistic_growth_init(self.history)
1183 return ModelParams(
1184 k=k,
1185 m=m,
1186 delta=np.zeros_like(self.changepoints_t),
1187 beta=np.zeros(num_total_regressors),
1188 sigma_obs=1.0,
1189 )
1190
1191 def fit(self, df, **kwargs):
1192 """Fit the Prophet model.

Callers 1

fitMethod · 0.95

Calls 4

linear_growth_initMethod · 0.95
flat_growth_initMethod · 0.95
logistic_growth_initMethod · 0.95
ModelParamsClass · 0.90

Tested by

no test coverage detected