def _set_regressor_matrix()

in orbit/template/dlt.py [0:0]


    def _set_regressor_matrix(self, df, num_of_observations):
        """Set regressor matrix based on the input data-frame.
        Notes
        -----
        In case of absence of regression, they will be set to np.array with dim (num_of_obs, 0) to fit Stan requirement
        """
        # 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 not np.all(np.isfinite(self.positive_regressor_matrix)):
                raise ModelException(
                    "Invalid regressors values. They must be all not missing and finite."
                )

        if self.num_of_negative_regressors > 0:
            self.negative_regressor_matrix = df.filter(
                items=self.negative_regressor_col,
            ).values
            if not np.all(np.isfinite(self.negative_regressor_matrix)):
                raise ModelException(
                    "Invalid regressors values. They must be all not missing and finite."
                )

        if self.num_of_regular_regressors > 0:
            self.regular_regressor_matrix = df.filter(
                items=self.regular_regressor_col,
            ).values
            if not np.all(np.isfinite(self.regular_regressor_matrix)):
                raise ModelException(
                    "Invalid regressors values. They must be all not missing and finite."
                )