diff --git a/examples/scripts/multi_class_classifier.py b/examples/scripts/multi_class_classifier.py index d58788e6..4efc3c40 100644 --- a/examples/scripts/multi_class_classifier.py +++ b/examples/scripts/multi_class_classifier.py @@ -13,11 +13,6 @@ from supervised import AutoML from supervised.exceptions import AutoMLException -# warnings.filterwarnings('error') -warnings.filterwarnings( - "error", category=pd.core.common.SettingWithCopyWarning -) # message="*ndarray*") - df = pd.read_csv("tests/data/iris_missing_values_missing_target.csv") X = df[["feature_1", "feature_2", "feature_3", "feature_4"]] y = df["class"] diff --git a/supervised/algorithms/registry.py b/supervised/algorithms/registry.py index a3ab1607..614380eb 100644 --- a/supervised/algorithms/registry.py +++ b/supervised/algorithms/registry.py @@ -3,7 +3,6 @@ MULTICLASS_CLASSIFICATION = "multiclass_classification" REGRESSION = "regression" - class AlgorithmsRegistry: registry = { BINARY_CLASSIFICATION: {}, @@ -65,3 +64,13 @@ def get_eval_metric(algorithm_name, ml_task, automl_eval_metric): return automl_eval_metric # Import algorithm to be registered +import supervised.algorithms.baseline +import supervised.algorithms.catboost +import supervised.algorithms.decision_tree +import supervised.algorithms.extra_trees +import supervised.algorithms.knn +import supervised.algorithms.lightgbm +import supervised.algorithms.linear +import supervised.algorithms.nn +import supervised.algorithms.random_forest +import supervised.algorithms.xgboost \ No newline at end of file diff --git a/supervised/utils/importance.py b/supervised/utils/importance.py index 9524bbe1..1dc05c6c 100644 --- a/supervised/utils/importance.py +++ b/supervised/utils/importance.py @@ -24,7 +24,7 @@ def log_loss_eps(y_true, y_pred): return ll -log_loss_scorer = make_scorer(log_loss_eps, greater_is_better=False, needs_proba=True) +log_loss_scorer = make_scorer(log_loss_eps, greater_is_better=False, response_method="predict_proba") class PermutationImportance: diff --git a/supervised/utils/metric.py b/supervised/utils/metric.py index 8bb61212..4fd0e6c4 100644 --- a/supervised/utils/metric.py +++ b/supervised/utils/metric.py @@ -20,10 +20,8 @@ def logloss(y_true, y_predicted, sample_weight=None): - epsilon = 1e-6 - y_predicted = sp.maximum(epsilon, y_predicted) - y_predicted = sp.minimum(1 - epsilon, y_predicted) - ll = log_loss(y_true, y_predicted, sample_weight=sample_weight) + # convert predicted values to float32 to avoid warnings + ll = log_loss(y_true, y_predicted.astype(np.float32), sample_weight=sample_weight) return ll