in orbit/template/dlt.py [0:0]
def set_init_values(self):
"""Override from base class"""
init_values = dict()
if self._seasonality > 1:
init_sea = np.clip(
np.random.normal(loc=0, scale=0.05, size=self._seasonality - 1),
-1.0,
1.0,
)
init_values[LatentSamplingParameters.INITIAL_SEASONALITY.value] = init_sea
if self.num_of_positive_regressors > 0:
x = np.clip(
np.random.normal(
loc=0, scale=0.1, size=self.num_of_positive_regressors
),
1e-5,
2.0,
)
init_values[
LatentSamplingParameters.REGRESSION_POSITIVE_COEFFICIENTS.value
] = x
if self.num_of_negative_regressors > 0:
x = np.clip(
np.random.normal(
loc=0, scale=0.1, size=self.num_of_negative_regressors
),
-2.0,
-1e-5,
)
init_values[
LatentSamplingParameters.REGRESSION_NEGATIVE_COEFFICIENTS.value
] = x
if self.num_of_regular_regressors > 0:
x = np.clip(
np.random.normal(loc=0, scale=0.1, size=self.num_of_regular_regressors),
-2.0,
2.0,
)
init_values[
LatentSamplingParameters.REGRESSION_REGULAR_COEFFICIENTS.value
] = x
self._init_values = init_values