Agglomerative Best Similarity/Distance.

This module contains classes to find the best similarity/distance equation based on Agglomerative Clustering.

class besimilarity.agglomerative_best.AgglomerativeBestSimilarity(show_result=False, result_count=5)[source]

A class to get best usage of similarity/distance with Agglomerative Clustering.

Parameters
  • show_result (bool, optional) – True if you want to show the result. The default is False.

  • result_count (int, optional) – The number of result to print out. The default is 5.

fit(df, n_clusters=2, affinity='all', linkage='all')[source]

Fit data with Agglomerative Clustering.

Parameters
  • df (pandas.DataFrame) – Dataframe to fit with Agglomerative Clustering

  • n_clusters (int, optional) – Number of cluster to generate, by default 2

  • affinity (str, optional) – Type of affinity to use, by default ‘all’

  • linkage (str, optional) – Type of linkage to use, by default ‘all’

Returns

Return type

None

get_result()[source]

Return the result of best similarity equation that match with the best linkage

Returns

result_df – Dataframe that contains the result of best similarity equation that match with the best linkage

Return type

pandas.DataFrame