def time_series_non_core_objectives(): non_core_time_series = [ obj_() for obj_ in get_non_core_objectives() if ProblemTypes.TIME_SERIES_REGRESSION in obj_.problem_types ] return non_core_time_series
from evalml.objectives import ( F1, MAPE, MSE, AccuracyBinary, AccuracyMulticlass, BalancedAccuracyBinary, BalancedAccuracyMulticlass, BinaryClassificationObjective, CostBenefitMatrix, ExpVariance, F1Macro, F1Micro, F1Weighted, LogLossBinary, MCCBinary, MCCMulticlass, MeanSquaredLogError, Precision, PrecisionMacro, PrecisionMicro, PrecisionWeighted, Recall, RecallMacro, RecallMicro, RecallWeighted, RootMeanSquaredError, RootMeanSquaredLogError) from evalml.objectives.utils import (_all_objectives_dict, get_non_core_objectives) EPS = 1e-5 all_automl_objectives = _all_objectives_dict() all_automl_objectives = { name: class_() for name, class_ in all_automl_objectives.items() if class_ not in get_non_core_objectives() } def test_input_contains_nan(): y_predicted = np.array([np.nan, 0, 0]) y_true = np.array([1, 2, 1]) for objective in all_automl_objectives.values(): with pytest.raises(ValueError, match="y_predicted contains NaN or infinity"): objective.score(y_true, y_predicted) y_true = np.array([np.nan, 0, 0]) y_predicted = np.array([1, 2, 0]) for objective in all_automl_objectives.values(): with pytest.raises(ValueError,