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)
| 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. |
no test coverage detected