Esempio n. 1
0
    def compute_scores(self,
                       X: np.ndarray,
                       y: np.ndarray,
                       name: str = "") -> pd.Series:
        scores = pd.Series()
        pred = self.predict(X)

        scores.loc["RMSE{}".format(name)] = rmse(pred, y)

        return scores
Esempio n. 2
0
    def compute_scores(self, X: np.ndarray, y: np.ndarray,
                       name: str = "") -> pd.Series:
        scores = pd.Series()
        pred = self.predict(X)
        X_array = self.extract_subdatasets(X)
        len_sequences = np.sum(((X_array[1] > -10)*1)[:, :, 1], axis=1)

        scores.loc["RMSE{}".format(name)] = rmse(pred[:, 1], y)

        scores.loc["conf_interval_prop_{}"
                   .format(name)] = conf_interval_prop(y, pred)

        scores.loc["conf_interval_size_{}"
                   .format(name)] = conf_interval_size(pred)

        idx_inf = len_sequences < 3
        scores.loc["rmse_inf{}".format(name)] = rmse(pred[idx_inf, 1],
                                                     y[idx_inf])

        idx_sup = len_sequences >= 3
        scores.loc["rmse_sup{}".format(name)] = rmse(pred[idx_sup, 1],
                                                     y[idx_sup])

        return scores
Esempio n. 3
0
    def score(self, X: np.ndarray, y: np.ndarray) -> float:
        """
        Computes rmse between target y and predictions for input X after
        extracting different subdatasets (image, scalar, and constant).

        Args:
            X  (np.ndarray):     Source array, containing all the type of
                                 inputs, concatenated in one dataframe.
            y    (np.ndarray):   Target

        Returns:
            float:  rmse of predictions
        """
        X = self.extract_subdatasets(X)
        pred = self.model.predict(X)
        return rmse(pred, y)