Skip to content

Commit

Permalink
more metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgiving committed May 25, 2024
1 parent 050719c commit 2f57829
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lkmeans/examples/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np
from numpy.typing import NDArray
from sklearn.metrics import accuracy_score, adjusted_mutual_info_score, adjusted_rand_score
from sklearn.metrics import accuracy_score, adjusted_mutual_info_score, adjusted_rand_score, completeness_score, homogeneity_score, normalized_mutual_info_score, v_measure_score
from tap import Tap

from lkmeans.clustering import HardSSLKMeans, LKMeans, SoftSSLKMeans
Expand Down Expand Up @@ -46,6 +46,10 @@ def calculate_metrics(labels: NDArray, generated_labels: NDArray) -> Dict[str, f
return {
'ari': float(adjusted_rand_score(labels, generated_labels)),
'ami': float(adjusted_mutual_info_score(labels, generated_labels)),
'completeness': float(completeness_score(labels, generated_labels)),
'homogeneity': float(homogeneity_score(labels, generated_labels)),
'nmi': float(normalized_mutual_info_score(labels, generated_labels)),
'v_measure': float(v_measure_score(labels, generated_labels)),
'accuracy': float(accuracy_score(labels, generated_labels)),
}

Expand Down

0 comments on commit 2f57829

Please sign in to comment.