pygmi.clust.cluster#

Cluster Analysis.

The cluster module performs unsupervised classification using the scikit-learn library.

Classes#

Cluster

Cluster analysis GUI.

Functions#

cluster(data[, cltype, sscale, rscale, min_cluster, ...])

Run the cluster analysis.

Module Contents#

class pygmi.clust.cluster.Cluster(parent=None)#

Bases: pygmi.misc.BasicModule

Cluster analysis GUI.

Parameters:

parent – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

combo()#

Set up combo box, used to choose clustering algorithm.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

update_vars()#

Update the variables.

pygmi.clust.cluster.cluster(data, cltype='K-Means', sscale=True, rscale=False, min_cluster=5, max_cluster=5, tol=0.0001, max_iter=300, eps=0.5, bthres=0.5, branchfac=50, xi=0.05, min_samples=5, showlog=print, piter=iter)#

Run the cluster analysis.

This function uses the scikit learn library.

Parameters:
  • data (list[pygmi.raster.datatypes.Data]) – List of PyGMI data.

  • cltype (str) – Cluster analysis type. Can be one of ‘K-Means’, ‘Mini Batch K-Means (fast)’, ‘Bisecting K-Means’, ‘DBSCAN’, ‘OPTICS’, ‘Birch’. The default is ‘K-Means’.

  • sscale (bool) – Use standard scaling. The default is True.

  • rscale (bool) – Use robust scaling. The default is False.

  • min_cluster (int) – Minimum number of clusters to find. The default is 5.

  • max_cluster (int) – Maximum number of clusters to find. The default is 5.

  • tol (float) – Tolerance (K-Means only). The default is 0.0001.

  • max_iter (int) – Maximum number of iterations (K-Means only). The default is 300.

  • eps (float) – Epsilon factor (DBSCAN only). The default is 0.5.

  • bthres (float) – Threshold for Birch. The default is 0.5.

  • branchfac (int) – Branching factor for Birch. The default is 50.

  • xi (float) – Minimum steepness on the reachability plot for OPTICS. The default is 0.05.

  • min_samples (int) – Minimum samples for DBSCAN. The default is 5.

  • showlog (collections.abc.Callable[..., None]) – Show information using a function. The default is print.

  • piter (collections.abc.Iterable) – Progress bar iterator. The default is iter.

Returns:

List of raster datasets of classes.

Return type:

list of Data