diff --git a/conftest.py b/conftest.py index 5c77aaeb..ee8dcf1c 100644 --- a/conftest.py +++ b/conftest.py @@ -7,7 +7,6 @@ def pytest_collection_modifyitems(config, items): - # numpy changed the str/repr formatting of numpy arrays in 1.14. We want to # run doctests only for numpy >= 1.14. skip_doctests = False diff --git a/examples/cluster/plot_kmedoids_digits.py b/examples/cluster/plot_kmedoids_digits.py index 11f7cc71..8bb7ab11 100644 --- a/examples/cluster/plot_kmedoids_digits.py +++ b/examples/cluster/plot_kmedoids_digits.py @@ -63,7 +63,6 @@ plot_cols = 2 for i, (model, description) in enumerate(selected_models): - # Obtain labels for each point in mesh. Use last trained model. model.fit(reduced_data) Z = model.predict(np.c_[xx.ravel(), yy.ravel()]) diff --git a/examples/plot_clara_digits.py b/examples/plot_clara_digits.py index e1bb1f54..a703c948 100644 --- a/examples/plot_clara_digits.py +++ b/examples/plot_clara_digits.py @@ -79,7 +79,6 @@ plot_cols = 2 for i, (model, description) in enumerate(selected_models): - # Obtain labels for each point in mesh. Use last trained model. init_time = time.time() model.fit(reduced_data) diff --git a/examples/plot_kmedoids.py b/examples/plot_kmedoids.py index 514ac41d..88856743 100644 --- a/examples/plot_kmedoids.py +++ b/examples/plot_kmedoids.py @@ -37,7 +37,6 @@ plt.cm.Spectral(each) for each in np.linspace(0, 1, len(unique_labels)) ] for k, col in zip(unique_labels, colors): - class_member_mask = labels == k xy = X[class_member_mask] diff --git a/sklearn_extra/robust/robust_weighted_estimator.py b/sklearn_extra/robust/robust_weighted_estimator.py index e0165671..76140398 100644 --- a/sklearn_extra/robust/robust_weighted_estimator.py +++ b/sklearn_extra/robust/robust_weighted_estimator.py @@ -308,7 +308,6 @@ def fit(self, X, y=None): # Optimization algorithm for epoch in range(self.max_iter): - if self._estimator_type == "classifier": # If in classification, use decision_function pred = base_estimator.decision_function(X) @@ -1016,7 +1015,6 @@ def __init__( verbose=0, random_state=None, ): - self.weighting = weighting self.max_iter = max_iter self.c = c diff --git a/sklearn_extra/robust/tests/test_mean_estimators.py b/sklearn_extra/robust/tests/test_mean_estimators.py index 0bce4dab..2f005662 100644 --- a/sklearn_extra/robust/tests/test_mean_estimators.py +++ b/sklearn_extra/robust/tests/test_mean_estimators.py @@ -8,6 +8,7 @@ sample = rng.normal(size=100) + # Check good in normal case def test_normal(): assert np.abs(median_of_means(sample, 3, rng)) < 1e-1 diff --git a/sklearn_extra/robust/tests/test_robust_weighted_estimator.py b/sklearn_extra/robust/tests/test_robust_weighted_estimator.py index 346849d3..aaecc603 100644 --- a/sklearn_extra/robust/tests/test_robust_weighted_estimator.py +++ b/sklearn_extra/robust/tests/test_robust_weighted_estimator.py @@ -118,6 +118,7 @@ def test_corrupted_classif(loss, weighting, k, c, multi_class): random_state=rng, ) + # check binary throw an error def test_robust_estimator_unsupported_loss(): model = RobustWeightedClassifier(multi_class="binary") @@ -259,7 +260,6 @@ def test_corrupted_regression(loss, weighting, k, c): @pytest.mark.parametrize("loss", regression_losses) @pytest.mark.parametrize("weighting", weightings) def test_corrupted_regression_multidim(loss, weighting): - n = 1000 d = 10 @@ -299,6 +299,7 @@ def test_regression_corrupted_weights(weighting): y_r = X_r + 0.1 * rng.normal(size=1000) X_r = X_r.reshape(-1, 1) + # Check that the fit is close to SGD when in extremal parameter cases @pytest.mark.parametrize("loss", regression_losses) @pytest.mark.parametrize("weighting", weightings) @@ -383,6 +384,7 @@ def test_corrupted_cluster(weighting, k, c): n_samples=100, centers=np.array([[-1, -1], [1, 1]]), random_state=rng ) + # Check that the fit is close to KMeans when in extremal parameter cases @pytest.mark.parametrize("weighting", weightings) def test_not_robust_cluster(weighting):