-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathsklearn.cluster.HDBSCAN.html
659 lines (618 loc) · 51.2 KB
/
sklearn.cluster.HDBSCAN.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<meta property="og:title" content="sklearn.cluster.HDBSCAN" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://scikit-learn/stable/modules/generated/sklearn.cluster.HDBSCAN.html" />
<meta property="og:site_name" content="scikit-learn" />
<meta property="og:description" content="Examples using sklearn.cluster.HDBSCAN: Release Highlights for scikit-learn 1.3 Comparing different clustering algorithms on toy datasets Demo of HDBSCAN clustering algorithm" />
<meta property="og:image" content="https://scikit-learn/stable/_images/sphx_glr_plot_release_highlights_1_3_0_thumb.png" />
<meta property="og:image:alt" content="" />
<meta name="description" content="Examples using sklearn.cluster.HDBSCAN: Release Highlights for scikit-learn 1.3 Comparing different clustering algorithms on toy datasets Demo of HDBSCAN clustering algorithm" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sklearn.cluster.HDBSCAN — scikit-learn 1.3.2 documentation</title>
<link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.cluster.HDBSCAN.html" />
<link rel="shortcut icon" href="../../_static/favicon.ico"/>
<link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/copybutton.css" type="text/css" />
<link rel="stylesheet" href="../../_static/plot_directive.css" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Vibur" type="text/css" />
<link rel="stylesheet" href="../../_static/jupyterlite_sphinx.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sg_gallery.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sg_gallery-binder.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sg_gallery-dataframe.css" type="text/css" />
<link rel="stylesheet" href="../../_static/sg_gallery-rendered-html.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/js/vendor/jquery-3.6.3.slim.min.js"></script>
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
<div class="container-fluid sk-docs-container px-0">
<a class="navbar-brand py-0" href="../../index.html">
<img
class="sk-brand-img"
src="../../_static/scikit-learn-logo-small.png"
alt="logo"/>
</a>
<button
id="sk-navbar-toggler"
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="sk-nav-link nav-link" href="../../install.html">Install</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="../classes.html">API</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link" target="_blank" rel="noopener noreferrer" href="https://blog.scikit-learn.org/">Community</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html" >Getting Started</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html" >Tutorial</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../whats_new/v1.3.html" >What's new</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html" >Glossary</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/developers/index.html" target="_blank" rel="noopener noreferrer">Development</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html" >FAQ</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../support.html" >Support</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html" >Related packages</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html" >Roadmap</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../governance.html" >Governance</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html" >About us</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn" >GitHub</a>
</li>
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html" >Other Versions and Download</a>
</li>
<li class="nav-item dropdown nav-more-item-dropdown">
<a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html" >Getting Started</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html" >Tutorial</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../whats_new/v1.3.html" >What's new</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html" >Glossary</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/developers/index.html" target="_blank" rel="noopener noreferrer">Development</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html" >FAQ</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../support.html" >Support</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html" >Related packages</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html" >Roadmap</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../governance.html" >Governance</a>
<a class="sk-nav-dropdown-item dropdown-item" href="../../about.html" >About us</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn" >GitHub</a>
<a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html" >Other Versions and Download</a>
</div>
</li>
</ul>
<div id="searchbox" role="search">
<div class="searchformwrapper">
<form class="search" action="../../search.html" method="get">
<input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
<input class="sk-search-text-btn" type="submit" value="Go" />
</form>
</div>
</div>
</div>
</div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
<input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
<label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
<div id="sk-sidebar-wrapper" class="border-right">
<div class="sk-sidebar-toc-wrapper">
<div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
<a href="sklearn.cluster.DBSCAN.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.cluster.DBSCAN">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
<a href="sklearn.cluster.FeatureAgglomeration.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.cluster.FeatureAgglomeration">Next</a>
</div>
<div class="alert alert-danger p-1 mb-2" role="alert">
<p class="text-center mb-0">
<strong>scikit-learn 1.3.2</strong><br/>
<a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
</p>
</div>
<div class="alert alert-warning p-1 mb-2" role="alert">
<p class="text-center mb-0">
Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
</p>
</div>
<div class="sk-sidebar-toc">
<ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.cluster</span></code>.HDBSCAN</a><ul>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN"><code class="docutils literal notranslate"><span class="pre">HDBSCAN</span></code></a><ul>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.dbscan_clustering"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.dbscan_clustering</span></code></a></li>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.fit"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.fit</span></code></a></li>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.fit_predict"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.fit_predict</span></code></a></li>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.get_metadata_routing"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.get_metadata_routing</span></code></a></li>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.get_params"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.get_params</span></code></a></li>
<li><a class="reference internal" href="#sklearn.cluster.HDBSCAN.set_params"><code class="docutils literal notranslate"><span class="pre">HDBSCAN.set_params</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples-using-sklearn-cluster-hdbscan">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.cluster.HDBSCAN</span></code></a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="sk-page-content-wrapper">
<div class="sk-page-content container-fluid body px-md-3" role="main">
<section id="sklearn-cluster-hdbscan">
<h1><a class="reference internal" href="../classes.html#module-sklearn.cluster" title="sklearn.cluster"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.cluster</span></code></a>.HDBSCAN<a class="headerlink" href="#sklearn-cluster-hdbscan" title="Permalink to this heading">¶</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">sklearn.cluster.</span></span><span class="sig-name descname"><span class="pre">HDBSCAN</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">min_cluster_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_samples</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cluster_selection_epsilon</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_cluster_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metric</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'euclidean'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metric_params</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">alpha</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">algorithm</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'auto'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">leaf_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">40</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_jobs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cluster_selection_method</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'eom'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allow_single_cluster</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">store_centers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">copy</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/cluster/_hdbscan/hdbscan.py#L409"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN" title="Permalink to this definition">¶</a></dt>
<dd><p>Cluster data using hierarchical density-based clustering.</p>
<p>HDBSCAN - Hierarchical Density-Based Spatial Clustering of Applications
with Noise. Performs <a class="reference internal" href="sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN" title="sklearn.cluster.DBSCAN"><code class="xref py py-class docutils literal notranslate"><span class="pre">DBSCAN</span></code></a> over varying epsilon
values and integrates the result to find a clustering that gives the best
stability over epsilon.
This allows HDBSCAN to find clusters of varying densities (unlike
<a class="reference internal" href="sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN" title="sklearn.cluster.DBSCAN"><code class="xref py py-class docutils literal notranslate"><span class="pre">DBSCAN</span></code></a>), and be more robust to parameter selection.
Read more in the <a class="reference internal" href="../clustering.html#hdbscan"><span class="std std-ref">User Guide</span></a>.</p>
<p>For an example of how to use HDBSCAN, as well as a comparison to
<a class="reference internal" href="sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN" title="sklearn.cluster.DBSCAN"><code class="xref py py-class docutils literal notranslate"><span class="pre">DBSCAN</span></code></a>, please see the <a class="reference internal" href="../../auto_examples/cluster/plot_hdbscan.html#sphx-glr-auto-examples-cluster-plot-hdbscan-py"><span class="std std-ref">plotting demo</span></a>.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 1.3.</span></p>
</div>
<dl class="field-list">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl>
<dt><strong>min_cluster_size</strong><span class="classifier">int, default=5</span></dt><dd><p>The minimum number of samples in a group for that group to be
considered a cluster; groupings smaller than this size will be left
as noise.</p>
</dd>
<dt><strong>min_samples</strong><span class="classifier">int, default=None</span></dt><dd><p>The number of samples in a neighborhood for a point
to be considered as a core point. This includes the point itself.
When <code class="docutils literal notranslate"><span class="pre">None</span></code>, defaults to <code class="docutils literal notranslate"><span class="pre">min_cluster_size</span></code>.</p>
</dd>
<dt><strong>cluster_selection_epsilon</strong><span class="classifier">float, default=0.0</span></dt><dd><p>A distance threshold. Clusters below this value will be merged.
See <a class="reference internal" href="#r6f313792b2b7-5" id="id1">[5]</a> for more information.</p>
</dd>
<dt><strong>max_cluster_size</strong><span class="classifier">int, default=None</span></dt><dd><p>A limit to the size of clusters returned by the <code class="docutils literal notranslate"><span class="pre">"eom"</span></code> cluster
selection algorithm. There is no limit when <code class="docutils literal notranslate"><span class="pre">max_cluster_size=None</span></code>.
Has no effect if <code class="docutils literal notranslate"><span class="pre">cluster_selection_method="leaf"</span></code>.</p>
</dd>
<dt><strong>metric</strong><span class="classifier">str or callable, default=’euclidean’</span></dt><dd><p>The metric to use when calculating distance between instances in a
feature array.</p>
<ul class="simple">
<li><p>If metric is a string or callable, it must be one of
the options allowed by <code class="xref py py-func docutils literal notranslate"><span class="pre">pairwise_distances</span></code>
for its metric parameter.</p></li>
<li><p>If metric is “precomputed”, X is assumed to be a distance matrix and
must be square.</p></li>
</ul>
</dd>
<dt><strong>metric_params</strong><span class="classifier">dict, default=None</span></dt><dd><p>Arguments passed to the distance metric.</p>
</dd>
<dt><strong>alpha</strong><span class="classifier">float, default=1.0</span></dt><dd><p>A distance scaling parameter as used in robust single linkage.
See <a class="reference internal" href="#r6f313792b2b7-3" id="id2">[3]</a> for more information.</p>
</dd>
<dt><strong>algorithm</strong><span class="classifier">{“auto”, “brute”, “kdtree”, “balltree”}, default=”auto”</span></dt><dd><p>Exactly which algorithm to use for computing core distances; By default
this is set to <code class="docutils literal notranslate"><span class="pre">"auto"</span></code> which attempts to use a
<a class="reference internal" href="sklearn.neighbors.KDTree.html#sklearn.neighbors.KDTree" title="sklearn.neighbors.KDTree"><code class="xref py py-class docutils literal notranslate"><span class="pre">KDTree</span></code></a> tree if possible, otherwise it uses
a <a class="reference internal" href="sklearn.neighbors.BallTree.html#sklearn.neighbors.BallTree" title="sklearn.neighbors.BallTree"><code class="xref py py-class docutils literal notranslate"><span class="pre">BallTree</span></code></a> tree. Both <code class="docutils literal notranslate"><span class="pre">"KDTree"</span></code> and
<code class="docutils literal notranslate"><span class="pre">"BallTree"</span></code> algorithms use the
<a class="reference internal" href="sklearn.neighbors.NearestNeighbors.html#sklearn.neighbors.NearestNeighbors" title="sklearn.neighbors.NearestNeighbors"><code class="xref py py-class docutils literal notranslate"><span class="pre">NearestNeighbors</span></code></a> estimator.</p>
<p>If the <code class="docutils literal notranslate"><span class="pre">X</span></code> passed during <code class="docutils literal notranslate"><span class="pre">fit</span></code> is sparse or <code class="docutils literal notranslate"><span class="pre">metric</span></code> is invalid for
both <a class="reference internal" href="sklearn.neighbors.KDTree.html#sklearn.neighbors.KDTree" title="sklearn.neighbors.KDTree"><code class="xref py py-class docutils literal notranslate"><span class="pre">KDTree</span></code></a> and
<a class="reference internal" href="sklearn.neighbors.BallTree.html#sklearn.neighbors.BallTree" title="sklearn.neighbors.BallTree"><code class="xref py py-class docutils literal notranslate"><span class="pre">BallTree</span></code></a>, then it resolves to use the
<code class="docutils literal notranslate"><span class="pre">"brute"</span></code> algorithm.</p>
</dd>
<dt><strong>leaf_size</strong><span class="classifier">int, default=40</span></dt><dd><p>Leaf size for trees responsible for fast nearest neighbour queries when
a KDTree or a BallTree are used as core-distance algorithms. A large
dataset size and small <code class="docutils literal notranslate"><span class="pre">leaf_size</span></code> may induce excessive memory usage.
If you are running out of memory consider increasing the <code class="docutils literal notranslate"><span class="pre">leaf_size</span></code>
parameter. Ignored for <code class="docutils literal notranslate"><span class="pre">algorithm="brute"</span></code>.</p>
</dd>
<dt><strong>n_jobs</strong><span class="classifier">int, default=None</span></dt><dd><p>Number of jobs to run in parallel to calculate distances.
<code class="docutils literal notranslate"><span class="pre">None</span></code> means 1 unless in a <a class="reference external" href="https://joblib.readthedocs.io/en/latest/generated/joblib.parallel_backend.html#joblib.parallel_backend" title="(in joblib v1.4.dev0)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">joblib.parallel_backend</span></code></a> context.
<code class="docutils literal notranslate"><span class="pre">-1</span></code> means using all processors. See <a class="reference internal" href="../../glossary.html#term-n_jobs"><span class="xref std std-term">Glossary</span></a>
for more details.</p>
</dd>
<dt><strong>cluster_selection_method</strong><span class="classifier">{“eom”, “leaf”}, default=”eom”</span></dt><dd><p>The method used to select clusters from the condensed tree. The
standard approach for HDBSCAN* is to use an Excess of Mass (<code class="docutils literal notranslate"><span class="pre">"eom"</span></code>)
algorithm to find the most persistent clusters. Alternatively you can
instead select the clusters at the leaves of the tree – this provides
the most fine grained and homogeneous clusters.</p>
</dd>
<dt><strong>allow_single_cluster</strong><span class="classifier">bool, default=False</span></dt><dd><p>By default HDBSCAN* will not produce a single cluster, setting this
to True will override this and allow single cluster results in
the case that you feel this is a valid result for your dataset.</p>
</dd>
<dt><strong>store_centers</strong><span class="classifier">str, default=None</span></dt><dd><p>Which, if any, cluster centers to compute and store. The options are:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">None</span></code> which does not compute nor store any centers.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">"centroid"</span></code> which calculates the center by taking the weighted
average of their positions. Note that the algorithm uses the
euclidean metric and does not guarantee that the output will be
an observed data point.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">"medoid"</span></code> which calculates the center by taking the point in the
fitted data which minimizes the distance to all other points in
the cluster. This is slower than “centroid” since it requires
computing additional pairwise distances between points of the
same cluster but guarantees the output is an observed data point.
The medoid is also well-defined for arbitrary metrics, and does not
depend on a euclidean metric.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">"both"</span></code> which computes and stores both forms of centers.</p></li>
</ul>
</dd>
<dt><strong>copy</strong><span class="classifier">bool, default=False</span></dt><dd><p>If <code class="docutils literal notranslate"><span class="pre">copy=True</span></code> then any time an in-place modifications would be made
that would overwrite data passed to <a class="reference internal" href="../../glossary.html#term-fit"><span class="xref std std-term">fit</span></a>, a copy will first be
made, guaranteeing that the original data will be unchanged.
Currently, it only applies when <code class="docutils literal notranslate"><span class="pre">metric="precomputed"</span></code>, when passing
a dense array or a CSR sparse matrix and when <code class="docutils literal notranslate"><span class="pre">algorithm="brute"</span></code>.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes<span class="colon">:</span></dt>
<dd class="field-even"><dl>
<dt><strong>labels_</strong><span class="classifier">ndarray of shape (n_samples,)</span></dt><dd><p>Cluster labels for each point in the dataset given to <a class="reference internal" href="../../glossary.html#term-fit"><span class="xref std std-term">fit</span></a>.
Outliers are labeled as follows:</p>
<ul class="simple">
<li><p>Noisy samples are given the label -1.</p></li>
<li><p>Samples with infinite elements (+/- np.inf) are given the label -2.</p></li>
<li><p>Samples with missing data are given the label -3, even if they
also have infinite elements.</p></li>
</ul>
</dd>
<dt><strong>probabilities_</strong><span class="classifier">ndarray of shape (n_samples,)</span></dt><dd><p>The strength with which each sample is a member of its assigned
cluster.</p>
<ul class="simple">
<li><p>Clustered samples have probabilities proportional to the degree that
they persist as part of the cluster.</p></li>
<li><p>Noisy samples have probability zero.</p></li>
<li><p>Samples with infinite elements (+/- np.inf) have probability 0.</p></li>
<li><p>Samples with missing data have probability <code class="docutils literal notranslate"><span class="pre">np.nan</span></code>.</p></li>
</ul>
</dd>
<dt><strong>n_features_in_</strong><span class="classifier">int</span></dt><dd><p>Number of features seen during <a class="reference internal" href="../../glossary.html#term-fit"><span class="xref std std-term">fit</span></a>.</p>
</dd>
<dt><strong>feature_names_in_</strong><span class="classifier">ndarray of shape (<code class="docutils literal notranslate"><span class="pre">n_features_in_</span></code>,)</span></dt><dd><p>Names of features seen during <a class="reference internal" href="../../glossary.html#term-fit"><span class="xref std std-term">fit</span></a>. Defined only when <code class="docutils literal notranslate"><span class="pre">X</span></code>
has feature names that are all strings.</p>
</dd>
<dt><strong>centroids_</strong><span class="classifier">ndarray of shape (n_clusters, n_features)</span></dt><dd><p>A collection containing the centroid of each cluster calculated under
the standard euclidean metric. The centroids may fall “outside” their
respective clusters if the clusters themselves are non-convex.</p>
<p>Note that <code class="docutils literal notranslate"><span class="pre">n_clusters</span></code> only counts non-outlier clusters. That is to
say, the <code class="docutils literal notranslate"><span class="pre">-1,</span> <span class="pre">-2,</span> <span class="pre">-3</span></code> labels for the outlier clusters are excluded.</p>
</dd>
<dt><strong>medoids_</strong><span class="classifier">ndarray of shape (n_clusters, n_features)</span></dt><dd><p>A collection containing the medoid of each cluster calculated under
the whichever metric was passed to the <code class="docutils literal notranslate"><span class="pre">metric</span></code> parameter. The
medoids are points in the original cluster which minimize the average
distance to all other points in that cluster under the chosen metric.
These can be thought of as the result of projecting the <code class="docutils literal notranslate"><span class="pre">metric</span></code>-based
centroid back onto the cluster.</p>
<p>Note that <code class="docutils literal notranslate"><span class="pre">n_clusters</span></code> only counts non-outlier clusters. That is to
say, the <code class="docutils literal notranslate"><span class="pre">-1,</span> <span class="pre">-2,</span> <span class="pre">-3</span></code> labels for the outlier clusters are excluded.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN" title="sklearn.cluster.DBSCAN"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DBSCAN</span></code></a></dt><dd><p>Density-Based Spatial Clustering of Applications with Noise.</p>
</dd>
<dt><a class="reference internal" href="sklearn.cluster.OPTICS.html#sklearn.cluster.OPTICS" title="sklearn.cluster.OPTICS"><code class="xref py py-obj docutils literal notranslate"><span class="pre">OPTICS</span></code></a></dt><dd><p>Ordering Points To Identify the Clustering Structure.</p>
</dd>
<dt><a class="reference internal" href="sklearn.cluster.Birch.html#sklearn.cluster.Birch" title="sklearn.cluster.Birch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Birch</span></code></a></dt><dd><p>Memory-efficient, online-learning algorithm.</p>
</dd>
</dl>
</div>
<p class="rubric">References</p>
<div role="list" class="citation-list">
<div class="citation" id="r6f313792b2b7-1" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://doi.org/10.1007/978-3-642-37456-2_14">Campello, R. J., Moulavi, D., & Sander, J. Density-based clustering
based on hierarchical density estimates.</a></p>
</div>
<div class="citation" id="r6f313792b2b7-2" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://doi.org/10.1145/2733381">Campello, R. J., Moulavi, D., Zimek, A., & Sander, J.
Hierarchical density estimates for data clustering, visualization,
and outlier detection.</a></p>
</div>
<div class="citation" id="r6f313792b2b7-3" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id2">3</a><span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://papers.nips.cc/paper/2010/hash/b534ba68236ba543ae44b22bd110a1d6-Abstract.html">Chaudhuri, K., & Dasgupta, S. Rates of convergence for the
cluster tree.</a></p>
</div>
<div class="citation" id="r6f313792b2b7-4" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span>4<span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://www.dbs.ifi.lmu.de/~zimek/publications/SDM2014/DBCV.pdf">Moulavi, D., Jaskowiak, P.A., Campello, R.J., Zimek, A. and
Sander, J. Density-Based Clustering Validation.</a></p>
</div>
<div class="citation" id="r6f313792b2b7-5" role="doc-biblioentry">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">5</a><span class="fn-bracket">]</span></span>
<p><a class="reference external" href="https://arxiv.org/abs/1911.02282">Malzer, C., & Baum, M. “A Hybrid Approach To Hierarchical
Density-based Cluster Selection.”</a>.</p>
</div>
</div>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sklearn.cluster</span> <span class="kn">import</span> <span class="n">HDBSCAN</span>
<span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">load_digits</span>
<span class="gp">>>> </span><span class="n">X</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">load_digits</span><span class="p">(</span><span class="n">return_X_y</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">hdb</span> <span class="o">=</span> <span class="n">HDBSCAN</span><span class="p">(</span><span class="n">min_cluster_size</span><span class="o">=</span><span class="mi">20</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">hdb</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">)</span>
<span class="go">HDBSCAN(min_cluster_size=20)</span>
<span class="gp">>>> </span><span class="n">hdb</span><span class="o">.</span><span class="n">labels_</span>
<span class="go">array([ 2, 6, -1, ..., -1, -1, -1])</span>
</pre></div>
</div>
<p class="rubric">Methods</p>
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.dbscan_clustering" title="sklearn.cluster.HDBSCAN.dbscan_clustering"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dbscan_clustering</span></code></a>(cut_distance[, ...])</p></td>
<td><p>Return clustering given by DBSCAN without border points.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.fit" title="sklearn.cluster.HDBSCAN.fit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit</span></code></a>(X[, y])</p></td>
<td><p>Find clusters based on hierarchical density-based clustering.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.fit_predict" title="sklearn.cluster.HDBSCAN.fit_predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit_predict</span></code></a>(X[, y])</p></td>
<td><p>Cluster X and return the associated cluster labels.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.get_metadata_routing" title="sklearn.cluster.HDBSCAN.get_metadata_routing"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_metadata_routing</span></code></a>()</p></td>
<td><p>Get metadata routing of this object.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.get_params" title="sklearn.cluster.HDBSCAN.get_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_params</span></code></a>([deep])</p></td>
<td><p>Get parameters for this estimator.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.cluster.HDBSCAN.set_params" title="sklearn.cluster.HDBSCAN.set_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_params</span></code></a>(**params)</p></td>
<td><p>Set the parameters of this estimator.</p></td>
</tr>
</tbody>
</table>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.dbscan_clustering">
<span class="sig-name descname"><span class="pre">dbscan_clustering</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cut_distance</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min_cluster_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">5</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/cluster/_hdbscan/hdbscan.py#L920"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.dbscan_clustering" title="Permalink to this definition">¶</a></dt>
<dd><p>Return clustering given by DBSCAN without border points.</p>
<p>Return clustering that would be equivalent to running DBSCAN* for a
particular cut_distance (or epsilon) DBSCAN* can be thought of as
DBSCAN without the border points. As such these results may differ
slightly from <code class="docutils literal notranslate"><span class="pre">cluster.DBSCAN</span></code> due to the difference in implementation
over the non-core points.</p>
<p>This can also be thought of as a flat clustering derived from constant
height cut through the single linkage tree.</p>
<p>This represents the result of selecting a cut value for robust single linkage
clustering. The <code class="docutils literal notranslate"><span class="pre">min_cluster_size</span></code> allows the flat clustering to declare noise
points (and cluster smaller than <code class="docutils literal notranslate"><span class="pre">min_cluster_size</span></code>).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>cut_distance</strong><span class="classifier">float</span></dt><dd><p>The mutual reachability distance cut value to use to generate a
flat clustering.</p>
</dd>
<dt><strong>min_cluster_size</strong><span class="classifier">int, default=5</span></dt><dd><p>Clusters smaller than this value with be called ‘noise’ and remain
unclustered in the resulting flat clustering.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><dl class="simple">
<dt><strong>labels</strong><span class="classifier">ndarray of shape (n_samples,)</span></dt><dd><p>An array of cluster labels, one per datapoint.
Outliers are labeled as follows:</p>
<ul class="simple">
<li><p>Noisy samples are given the label -1.</p></li>
<li><p>Samples with infinite elements (+/- np.inf) are given the label -2.</p></li>
<li><p>Samples with missing data are given the label -3, even if they
also have infinite elements.</p></li>
</ul>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.fit">
<span class="sig-name descname"><span class="pre">fit</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">X</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/cluster/_hdbscan/hdbscan.py#L678"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Find clusters based on hierarchical density-based clustering.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix} of shape (n_samples, n_features), or ndarray of shape (n_samples, n_samples)</span></dt><dd><p>A feature array, or array of distances between samples if
<code class="docutils literal notranslate"><span class="pre">metric='precomputed'</span></code>.</p>
</dd>
<dt><strong>y</strong><span class="classifier">None</span></dt><dd><p>Ignored.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">object</span></dt><dd><p>Returns self.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.fit_predict">
<span class="sig-name descname"><span class="pre">fit_predict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">X</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/cluster/_hdbscan/hdbscan.py#L855"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.fit_predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Cluster X and return the associated cluster labels.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix} of shape (n_samples, n_features), or ndarray of shape (n_samples, n_samples)</span></dt><dd><p>A feature array, or array of distances between samples if
<code class="docutils literal notranslate"><span class="pre">metric='precomputed'</span></code>.</p>
</dd>
<dt><strong>y</strong><span class="classifier">None</span></dt><dd><p>Ignored.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y</strong><span class="classifier">ndarray of shape (n_samples,)</span></dt><dd><p>Cluster labels.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.get_metadata_routing">
<span class="sig-name descname"><span class="pre">get_metadata_routing</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/utils/_metadata_requests.py#L1243"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.get_metadata_routing" title="Permalink to this definition">¶</a></dt>
<dd><p>Get metadata routing of this object.</p>
<p>Please check <a class="reference internal" href="../../metadata_routing.html#metadata-routing"><span class="std std-ref">User Guide</span></a> on how the routing
mechanism works.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>routing</strong><span class="classifier">MetadataRequest</span></dt><dd><p>A <a class="reference internal" href="sklearn.utils.metadata_routing.MetadataRequest.html#sklearn.utils.metadata_routing.MetadataRequest" title="sklearn.utils.metadata_routing.MetadataRequest"><code class="xref py py-class docutils literal notranslate"><span class="pre">MetadataRequest</span></code></a> encapsulating
routing information.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.get_params">
<span class="sig-name descname"><span class="pre">get_params</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">deep</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/base.py#L178"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.get_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters for this estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>deep</strong><span class="classifier">bool, default=True</span></dt><dd><p>If True, will return the parameters for this estimator and
contained subobjects that are estimators.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><dl class="simple">
<dt><strong>params</strong><span class="classifier">dict</span></dt><dd><p>Parameter names mapped to their values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="sklearn.cluster.HDBSCAN.set_params">
<span class="sig-name descname"><span class="pre">set_params</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">params</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/3f89022fa/sklearn/base.py#L202"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sklearn.cluster.HDBSCAN.set_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parameters of this estimator.</p>
<p>The method works on simple estimators as well as on nested objects
(such as <a class="reference internal" href="sklearn.pipeline.Pipeline.html#sklearn.pipeline.Pipeline" title="sklearn.pipeline.Pipeline"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pipeline</span></code></a>). The latter have
parameters of the form <code class="docutils literal notranslate"><span class="pre"><component>__<parameter></span></code> so that it’s
possible to update each component of a nested object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>**params</strong><span class="classifier">dict</span></dt><dd><p>Estimator parameters.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">estimator instance</span></dt><dd><p>Estimator instance.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
</dd></dl>
<section id="examples-using-sklearn-cluster-hdbscan">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.cluster.HDBSCAN</span></code><a class="headerlink" href="#examples-using-sklearn-cluster-hdbscan" title="Permalink to this heading">¶</a></h2>
<div class="sphx-glr-thumbnails"><div class="sphx-glr-thumbcontainer" tooltip="We are pleased to announce the release of scikit-learn 1.3! Many bug fixes and improvements wer..."><img alt="" src="../../_images/sphx_glr_plot_release_highlights_1_3_0_thumb.png" />
<p><a class="reference internal" href="../../auto_examples/release_highlights/plot_release_highlights_1_3_0.html#sphx-glr-auto-examples-release-highlights-plot-release-highlights-1-3-0-py"><span class="std std-ref">Release Highlights for scikit-learn 1.3</span></a></p>
<div class="sphx-glr-thumbnail-title">Release Highlights for scikit-learn 1.3</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example shows characteristics of different clustering algorithms on datasets that are "int..."><img alt="" src="../../_images/sphx_glr_plot_cluster_comparison_thumb.png" />
<p><a class="reference internal" href="../../auto_examples/cluster/plot_cluster_comparison.html#sphx-glr-auto-examples-cluster-plot-cluster-comparison-py"><span class="std std-ref">Comparing different clustering algorithms on toy datasets</span></a></p>
<div class="sphx-glr-thumbnail-title">Comparing different clustering algorithms on toy datasets</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In this demo we will take a look at cluster.HDBSCAN from the perspective of generalizing the cl..."><img alt="" src="../../_images/sphx_glr_plot_hdbscan_thumb.png" />
<p><a class="reference internal" href="../../auto_examples/cluster/plot_hdbscan.html#sphx-glr-auto-examples-cluster-plot-hdbscan-py"><span class="std std-ref">Demo of HDBSCAN clustering algorithm</span></a></p>
<div class="sphx-glr-thumbnail-title">Demo of HDBSCAN clustering algorithm</div>
</div></div><div class="clearer"></div></section>
</section>
</div>
<div class="container">
<footer class="sk-content-footer">
© 2007 - 2023, scikit-learn developers (BSD License).
<a href="../../_sources/modules/generated/sklearn.cluster.HDBSCAN.rst.txt" rel="nofollow">Show this page source</a>
</footer>
</div>
</div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-22606712-2', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<script defer data-domain="scikit-learn.org" src="https://views.scientific-python.org/js/script.js">
</script>
<script src="../../_static/clipboard.min.js"></script>
<script src="../../_static/copybutton.js"></script>
<script>
$(document).ready(function() {
/* Add a [>>>] button on the top-right corner of code samples to hide
* the >>> and ... prompts and the output and thus make the code
* copyable. */
var div = $('.highlight-python .highlight,' +
'.highlight-python3 .highlight,' +
'.highlight-pycon .highlight,' +
'.highlight-default .highlight')
var pre = div.find('pre');
// get the styles from the current theme
pre.parent().parent().css('position', 'relative');
// create and add the button to all the code blocks that contain >>>
div.each(function(index) {
var jthis = $(this);
// tracebacks (.gt) contain bare text elements that need to be
// wrapped in a span to work with .nextUntil() (see later)
jthis.find('pre:has(.gt)').contents().filter(function() {
return ((this.nodeType == 3) && (this.data.trim().length > 0));
}).wrap('<span>');
});
/*** Add permalink buttons next to glossary terms ***/
$('dl.glossary > dt[id]').append(function() {
return ('<a class="headerlink" href="#' +
this.getAttribute('id') +
'" title="Permalink to this term">¶</a>');
});
});
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<script src="https://scikit-learn.org/versionwarning.js"></script>
</body>
</html>