summaryrefslogtreecommitdiff
path: root/src/python/doc/clustering.rst
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-03-14 22:36:44 +0100
committerMarc Glisse <marc.glisse@inria.fr>2020-03-14 22:36:44 +0100
commite5fb8b28dbec64babe2357ba2963553ef8f76692 (patch)
tree48ddf79edb473a5b7ceb5952cb16e7ef6060a6ff /src/python/doc/clustering.rst
parent14d92f8d0c19b58ca59701e6e6bedf174a142922 (diff)
variant in the doc
Diffstat (limited to 'src/python/doc/clustering.rst')
-rw-r--r--src/python/doc/clustering.rst23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/python/doc/clustering.rst b/src/python/doc/clustering.rst
index 0e2a4bd5..dc9de968 100644
--- a/src/python/doc/clustering.rst
+++ b/src/python/doc/clustering.rst
@@ -43,7 +43,28 @@ As one can see in `t.n_clusters_`, the algorithm found 6316 initial clusters. Th
.. image:: img/spiral-color.png
-Of course this is just the result for one set of parameters. We can ask for a different density estimator and a different neighborhood graph computed with different parameters. The code provides a few of those for convenience when first experimenting, but it is actually expected that users provide their own graph and density estimates instead of point coordinates.
+Of course this is just the result for one set of parameters. We can ask for a different density estimator and a different neighborhood graph computed with different parameters.
+
+.. code-block::
+
+ t = Tomato(density_type='DTM', k=100)
+ t.fit(data)
+ t.plot_diagram()
+
+Makes the number of clusters clearer, and changes a bit the shape of the clusters.
+
+.. image:: img/spiral-diag2.png
+
+A quick look at the corresponding density estimate (`weights_` is not officially supported)
+
+.. code-block::
+
+ plt.scatter(data[:,0],data[:,1],marker='.',s=1,c=t.weights_)
+ plt.show()
+
+.. image:: img/spiral-density.png
+
+The code provides a few density estimators and graph constructions for convenience when first experimenting, but it is actually expected that advanced users provide their own graph and density estimates instead of point coordinates.
Since the algorithm essentially computes basins of attraction, it is also encouraged to use it on functions that do not represent densities at all.