pygmi.clust.cluster#

ClusterAnalysis.

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 (parent, optional) – Reference to the parent routine. The default is None.

setupui()#

Set up UI.

Return type:

None.

combo()#

Set up combo box, used to choose clustering algorithm.

Return type:

None.

settings(nodialog=False)#

Entry point into item.

Parameters:

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

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

Return type:

None.

update_vars()#

Update the variables.

Return type:

None.

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) – List of PyGMI data.

  • cltype (str, optional) – 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, optional) – Use standard scaling. The default is True.

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

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

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

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

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

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

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

  • branchfac (float, optional) – Branching factor for Birch. The default is 50.

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

  • min_samples (int, optional) – Minimu samples for DBSCAN. The default is 5.

  • showlog (function, optional) – Show information using a function. The default is print.

  • piter (function, optional) – Progress bar iterator. The default is iter.

Returns:

List of raster datasets of classes.

Return type:

list