Skip to content

Commit

Permalink
remove pd->np and metrics from non neg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remyogasawara committed Jul 6, 2023
1 parent cf953db commit 5569083
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
12 changes: 1 addition & 11 deletions evalml/objectives/standard_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,12 +843,7 @@ def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
"Mean Absolute Scaled Error cannot be used when "
"all training targets contain the value 0.",
)
if isinstance(y_true, pd.Series):
y_true = y_true.to_numpy()
if isinstance(y_predicted, pd.Series):
y_predicted = y_predicted.to_numpy()
if isinstance(y_train, pd.Series):
y_train = y_train.to_numpy()

mase = MeanAbsoluteScaledError()
return mase(y_true, y_predicted, y_train=y_train)

Expand Down Expand Up @@ -911,11 +906,6 @@ def objective_function(self, y_true, y_predicted, X=None, sample_weight=None):
"Symmetric Mean Absolute Percentage Error cannot be used when "
"true and predicted targets both contain the value 0.",
)
if isinstance(y_true, pd.Series):
y_true = y_true.to_numpy()
if isinstance(y_predicted, pd.Series):
y_predicted = y_predicted.to_numpy()

smape = MeanAbsolutePercentageError(symmetric=True)
return smape(y_true, y_predicted) * 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
)
from evalml.exceptions import DataCheckInitError
from evalml.objectives import (
MAPE,
MASE,
SMAPE,
MeanSquaredLogError,
RootMeanSquaredLogError,
)
Expand Down Expand Up @@ -348,7 +345,6 @@ def test_invalid_target_data_check_n_unique(problem_type):
[
"Root Mean Squared Log Error",
"Mean Squared Log Error",
"Mean Absolute Percentage Error",
],
)
def test_invalid_target_data_check_invalid_labels_for_nonnegative_objective_names(
Expand Down Expand Up @@ -403,7 +399,7 @@ def test_invalid_target_data_check_invalid_labels_for_nonnegative_objective_name

@pytest.mark.parametrize(
"objective",
[RootMeanSquaredLogError(), MeanSquaredLogError(), MASE(), MAPE(), SMAPE()],
[RootMeanSquaredLogError(), MeanSquaredLogError()],
)
def test_invalid_target_data_check_invalid_labels_for_nonnegative_objective_instances(
objective,
Expand Down Expand Up @@ -471,7 +467,6 @@ def test_invalid_target_data_check_invalid_labels_for_objectives(
[
"Root Mean Squared Log Error",
"Mean Squared Log Error",
"Mean Absolute Percentage Error",
],
)
def test_invalid_target_data_check_valid_labels_for_nonnegative_objectives(objective):
Expand Down

0 comments on commit 5569083

Please sign in to comment.