From 22b177b3c91749814f321f9baa1c1325f35095c4 Mon Sep 17 00:00:00 2001 From: Gauthier I Date: Wed, 10 Nov 2021 17:18:50 +0100 Subject: [PATCH 1/4] Reduced n_samples to increse speed --- examples/cluster/plot_cluster_comparison.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cluster/plot_cluster_comparison.py b/examples/cluster/plot_cluster_comparison.py index 802f3996bbe7e..9bbe9dcdba6a5 100644 --- a/examples/cluster/plot_cluster_comparison.py +++ b/examples/cluster/plot_cluster_comparison.py @@ -41,7 +41,7 @@ # Generate datasets. We choose the size big enough to see the scalability # of the algorithms, but not too big to avoid too long running times # ============ -n_samples = 1500 +n_samples = 500 noisy_circles = datasets.make_circles(n_samples=n_samples, factor=0.5, noise=0.05) noisy_moons = datasets.make_moons(n_samples=n_samples, noise=0.05) blobs = datasets.make_blobs(n_samples=n_samples, random_state=8) From f92e2b2bd40f56a7e08fa35f44c5ba1c588227ce Mon Sep 17 00:00:00 2001 From: Gauthier I Date: Thu, 23 Dec 2021 17:15:34 +0100 Subject: [PATCH 2/4] ENH imporved visuals of Optic method for the first two dataset, still working on the other datasets --- examples/cluster/plot_cluster_comparison.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/cluster/plot_cluster_comparison.py b/examples/cluster/plot_cluster_comparison.py index 9bbe9dcdba6a5..966b042cdf88f 100644 --- a/examples/cluster/plot_cluster_comparison.py +++ b/examples/cluster/plot_cluster_comparison.py @@ -74,9 +74,9 @@ "eps": 0.3, "damping": 0.9, "preference": -200, - "n_neighbors": 10, + "n_neighbors": 3, "n_clusters": 3, - "min_samples": 20, + "min_samples": 7, "xi": 0.05, "min_cluster_size": 0.1, } @@ -89,18 +89,27 @@ "preference": -240, "quantile": 0.2, "n_clusters": 2, - "min_samples": 20, - "xi": 0.25, + "min_samples": 7, + "xi": 0.08, }, ), - (noisy_moons, {"damping": 0.75, "preference": -220, "n_clusters": 2}), + ( + noisy_moons, + { + "damping": 0.75, + "preference": -220, + "n_clusters": 2, + "min_samples": 7, + "xi": 0.1, + } + ), ( varied, { "eps": 0.18, "n_neighbors": 2, "min_samples": 5, - "xi": 0.035, + "xi": 0.05, "min_cluster_size": 0.2, }, ), From 2b002d4144a3306508be8f93f02495b15254c75d Mon Sep 17 00:00:00 2001 From: Gauthier I Date: Sat, 25 Dec 2021 11:02:38 +0100 Subject: [PATCH 3/4] ENH improved visuals for Optic method by tuning parameters --- examples/cluster/plot_cluster_comparison.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/cluster/plot_cluster_comparison.py b/examples/cluster/plot_cluster_comparison.py index 966b042cdf88f..eb038d267124a 100644 --- a/examples/cluster/plot_cluster_comparison.py +++ b/examples/cluster/plot_cluster_comparison.py @@ -108,8 +108,8 @@ { "eps": 0.18, "n_neighbors": 2, - "min_samples": 5, - "xi": 0.05, + "min_samples": 7, + "xi": 0.01, "min_cluster_size": 0.2, }, ), @@ -118,12 +118,19 @@ { "eps": 0.15, "n_neighbors": 2, - "min_samples": 20, + "min_samples": 7, "xi": 0.1, "min_cluster_size": 0.2, }, ), - (blobs, {}), + ( + blobs, + { + "min_samples": 7, + "xi": 0.1, + "min_cluster_size": 0.2, + } + ), (no_structure, {}), ] From 5c7f00deb0c250c3405f555dfb68e86a92ebc6be Mon Sep 17 00:00:00 2001 From: Gauthier I Date: Sat, 25 Dec 2021 11:16:48 +0100 Subject: [PATCH 4/4] Linting with black --- examples/cluster/plot_cluster_comparison.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/cluster/plot_cluster_comparison.py b/examples/cluster/plot_cluster_comparison.py index eb038d267124a..8b52759c79018 100644 --- a/examples/cluster/plot_cluster_comparison.py +++ b/examples/cluster/plot_cluster_comparison.py @@ -101,7 +101,7 @@ "n_clusters": 2, "min_samples": 7, "xi": 0.1, - } + }, ), ( varied, @@ -123,14 +123,7 @@ "min_cluster_size": 0.2, }, ), - ( - blobs, - { - "min_samples": 7, - "xi": 0.1, - "min_cluster_size": 0.2, - } - ), + (blobs, {"min_samples": 7, "xi": 0.1, "min_cluster_size": 0.2}), (no_structure, {}), ]