in orbit/template/ktr.py [0:0]
def _set_regressor_matrix(self, df, training_meta):
num_of_observations = training_meta[TrainingMetaKeys.NUM_OF_OBS.value]
# validate regression columns
if self.regressor_col is not None and not set(self.regressor_col).issubset(
df.columns
):
raise ModelException(
"DataFrame does not contain specified regressor column(s)."
)
# init of regression matrix depends on length of response vector
self._positive_regressor_matrix = np.zeros(
(num_of_observations, 0), dtype=np.double
)
self._negative_regressor_matrix = np.zeros(
(num_of_observations, 0), dtype=np.double
)
self._regular_regressor_matrix = np.zeros(
(num_of_observations, 0), dtype=np.double
)
# update regression matrices
if self._num_of_positive_regressors > 0:
self._positive_regressor_matrix = df.filter(
items=self._positive_regressor_col,
).values
if self._num_of_negative_regressors > 0:
self._negative_regressor_matrix = df.filter(
items=self._negative_regressor_col,
).values
if self._num_of_regular_regressors > 0:
self._regular_regressor_matrix = df.filter(
items=self._regular_regressor_col,
).values