def _calc(self, name, expected, predicted):
        """
            a
        """

        if self.dict_errors[name] == "Not calculated":
            if name == "mae":
                error = expected - predicted
                self.dict_errors[name] = np.mean(np.fabs(error))

            elif name == "me":
                error = expected - predicted
                self.dict_errors[name] = error.mean()

            elif name == "mse":
                error = expected - predicted
                self.dict_errors[name] = (error ** 2).mean()

            elif name == "rmse":
                error = expected - predicted
                self.dict_errors[name] = np.sqrt((error ** 2).mean())

            elif name == "mpe":

                if np.count_nonzero(expected != 0) == 0:
                    self.dict_errors[name] = np.nan
                else:
                    # Remove all indexes that have 0, so I can calculate
                    # relative error
                    find_zero = expected != 0
                    _et = np.extract(find_zero, expected)
                    _pt = np.extract(find_zero, predicted)

                    relative_error = (_et - _pt) / _et

                    self.dict_errors[name] = 100 * relative_error.mean()

            elif name == "mape":

                if np.count_nonzero(expected != 0) == 0:
                    self.dict_errors[name] = np.nan
                else:
                    # Remove all indexes that have 0, so I can calculate
                    # relative error
                    find_zero = expected != 0
                    _et = np.extract(find_zero, expected)
                    _pt = np.extract(find_zero, predicted)

                    relative_error = (_et - _pt) / _et

                    self.dict_errors[name] = \
                        100 * np.fabs(relative_error).mean()

            elif name == "std":
                error = expected - predicted
                self.dict_errors[name] = np.std(error)

            elif name == "hr":
                _c = expected * predicted

                if np.count_nonzero(_c != 0) == 0:
                    self.dict_errors[name] = np.nan
                else:
                    self.dict_errors[name] = np.count_nonzero(_c > 0) / \
                                             np.count_nonzero(_c != 0)

            elif name == "hr+":
                _a = expected
                _b = predicted

                if np.count_nonzero(_b > 0) == 0:
                    self.dict_errors[name] = np.nan
                else:
                    self.dict_errors[name] = \
                        np.count_nonzero((_a > 0) * (_b > 0)) / \
                        np.count_nonzero(_b > 0)

            elif name == "hr-":
                _a = expected
                _b = predicted

                if np.count_nonzero(_b < 0) == 0:
                    self.dict_errors[name] = np.nan
                else:
                    self.dict_errors[name] = \
                        np.count_nonzero((_a < 0) * (_b < 0)) / \
                        np.count_nonzero(_b < 0)

            elif name == "accuracy":
                _a = expected.astype(int)
                _b = np.round(predicted).astype(int)

                self.dict_errors[name] = np.count_nonzero(_a == _b) / _b.size

            else:
                print("Error:", name,
                      "- Invalid error or not available to calculate.")
                return
dataset/ETHPy150Open acba/elm/elm/mltools.py/Error._calc/original