KwanLab / Autometa

Autometa: Automated Extraction of Genomes from Shotgun Metagenomes
https://autometa.readthedocs.io
Other
40 stars 15 forks source link

Add `average_method` argument to `compute_clustering_metrics` function #289

Closed evanroyrees closed 1 year ago

evanroyrees commented 2 years ago

https://github.com/KwanLab/Autometa/blob/350ff103ff21dfc6fab4d5e09b6e858e60b74cd6/autometa/validation/benchmark.py#L149-L153

Changing the metric normalizer is currently not supported, passing through average_method to compute_clustering_metrics provides access to other normalizers

def compute_clustering_metrics(..., average_method="max"):
    # average_method = 'max' is *Normalized Information Distance (NID)*
    # Follows metric property and range is [0, 1] (Vinh et al. 2010)
    ...
    nmi = normalized_mutual_info_score(
        labels_true=labels.true,
        labels_pred=labels.pred,
        average_method=average_method, # choices: min, geometric, arithmetic, max
    )

average_method choices are listed in github.com/scikit-learn/sklearn/metrics/cluster/_supervised.py#L76-L89