sab_clustering module

sab_clustering.cluster_data_2d(model, X, y_true, y_dict)

Apply the clustering model on the 2D data X Cluster trials between a fixed number of clusters, defined in the model.

Parameters:
model : sklearn.cluster model

The scikit learn clustering model. Use the sab_clustering.get_clustering_algo() function to get the model.

X : 2D array [n_trials, n_features]

Input array to cluster

y_true : 1D array [n_trials]

True label of each trial

y_dict : dict

Dictionnary giving the label names

Returns:
ct : pandas DataFrame

Output cross-tabulation DataFrame

sab_clustering.get_clustering_algo(algo_name, n_clusters)

Return the clustering model given its name

Parameters:
algo_name : str
Must be in :
  • ‘kmeans’
  • ‘affinitypropagation’
  • ‘spectralclustering’
  • ‘agglomerativeclustering’
  • ‘dbscan’
n_clusters : int

Number of clusters

Returns:
model : sklearn.cluster model

The Scikit learn clustering model