This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def jaccard(labels1, labels2): | |
""" | |
Computes the Jaccard similarity between two sets of clustering labels. | |
The value returned is between 0 and 1, inclusively. A value of 1 indicates | |
perfect agreement between two clustering algorithms, whereas a value of 0 | |
indicates no agreement. For details on the Jaccard index, see: | |
http://en.wikipedia.org/wiki/Jaccard_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scaler = StandardScaler() | |
df=scaler.fit_transform(df) | |
kmeans_kwargs = {"init": "random","n_init": 20,"max_iter": 1000,"random_state": 1984} | |
cut_off=0.5 | |
maxvars=3 | |
kmin=2 | |
kmax=8 | |
cols=list(df.columns) |