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

Method flat_growth_init

python/prophet/forecaster.py:1101–1119  ·  view source on GitHub ↗

Initialize flat growth. Provides a strong initialization for flat growth. Sets the growth to 0 and offset parameter as mean of history y_scaled values. Parameters ---------- df: pd.DataFrame with columns ds (date), y_scaled (scaled time series),

(df)

Source from the content-addressed store, hash-verified

1099
1100 @staticmethod
1101 def flat_growth_init(df):
1102 """Initialize flat growth.
1103
1104 Provides a strong initialization for flat growth. Sets the growth to 0
1105 and offset parameter as mean of history y_scaled values.
1106
1107 Parameters
1108 ----------
1109 df: pd.DataFrame with columns ds (date), y_scaled (scaled time series),
1110 and t (scaled time).
1111
1112 Returns
1113 -------
1114 A tuple (k, m) with the rate (k) and offset (m) of the linear growth
1115 function.
1116 """
1117 k = 0
1118 m = df['y_scaled'].mean()
1119 return k, m
1120
1121 def preprocess(self, df: pd.DataFrame, **kwargs) -> ModelInputData:
1122 """

Callers 3

test_growth_initMethod · 0.95

Calls

no outgoing calls

Tested by 2

test_growth_initMethod · 0.76