RFoT.clustering package#

Submodules#

RFoT.clustering.component module#

Treats a single component as a cluster.

RFoT.clustering.component.component_cluster(params)[source]#

Uses a single component as a cluster.

Parameters

params (dict) -- Dict containing the latent component.

Returns

  • np.ndarray -- Cluster labels.

  • int -- Number of clusters.

RFoT.clustering.gmm module#

Gaussian Mixture Model clustering.

RFoT.clustering.gmm.GaussianMixture_find_n(M_r, min_, max_, random_state)[source]#

Finds the optimal number of clusters using BIC score for component r of KRUSKAL tensor M_i.

Parameters
  • M_r (np.ndarray) -- latent factor.

  • min (int) -- Min clusters.

  • max (int) -- Max clusters.

  • random_state (int) -- Random state.

Returns

Number of clusers.

Return type

int

RFoT.clustering.gmm.GaussianMixture_get_labels(M_r, n, random_state)[source]#

Extracts the cluster labels for KRUSKAL tensor M_r for n clusters. M_r is the rth component of the KRUSKAL tensor M_i.

Parameters
  • M_r (np.ndarray) -- latent factor.

  • n (int) -- Number of clusters.

  • random_state (int) -- Random state.

Returns

Labels.

Return type

np.ndarray

RFoT.clustering.gmm.gmm_cluster(params)[source]#

RFoT.clustering.ms module#

Mean Shift clustering

RFoT.clustering.ms.ms_cluster(params)[source]#

Performs MS clustering in the latent factor.

Parameters

params (dict) -- Dictionary with the latent factor and random state.

Returns

  • np.ndarray -- Cluster labels.

  • int -- Number of clusters.

Module contents#