Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA011 · Metric
Adjusted mutual information
Compares the information shared by two partitions after correcting for expected chance agreement.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- Choose the number of clusters Verified in Python and R
- Gaussian mixture model Verified in Python and R
- k-means clustering Verified in Python and R
- How stable are the clusters? (bootstrap) Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Complete calculation
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through discover.choose_k, discover.gmm, discover.kmeans, discover.stability. The reference's example ran here in one language.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Compares the information shared by two partitions after correcting for expected chance agreement.
Question / hypotheses
How much partition information is shared beyond a fixed-marginal random baseline?
Architecture / computational structure
A fixed scoring/calibration pipeline applied to model outputs or supplied observations; the formula and usage sections identify its operations.
Assumptions
Observations must align, and the chance model and entropy normalization must be specified. This is a descriptive agreement measure, not an independence test.
Formula / computational definition
Parameters and notation
I is mutual information; H is entropy; M may be arithmetic, geometric, min, or max normalization. The expected MI term depends on partition margins.
Fitting, fine-tuning, and adaptation
There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.
How to use and calibrate
Use a tested implementation for the hypergeometric expectation. Report the averaging method and compare the contingency table to determine whether disagreements are splits or merges.
Example application
Compare topic partitions produced by two embedding pipelines with different cluster counts.
Interpretation / pitfalls
Watch out
Normalized MI is not adjusted MI: omitting the expectation can reward too many clusters. AMI can be negative. High agreement says nothing about whether the discovered groups are useful.
Python and R code examples
Scope: Full AMI calculation; R uses an explicitly labeled Python bridge, not a native R implementation.
Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Complete calculation — Full AMI calculation; R uses an explicitly labeled Python bridge, not a native R implementation. · needs sklearn
from sklearn.metrics import adjusted_mutual_info_score
print(adjusted_mutual_info_score([0,0,0,1,1,1],[1,1,0,0,0,0],average_method="arithmetic"))
Bridge to another language — Full AMI calculation; R uses an explicitly labeled Python bridge, not a native R implementation. · needs reticulate
# Explicit bridge to the same estimator; requires reticulate and Python scikit-learn.
metrics <- reticulate::import("sklearn.metrics")
print(metrics$adjusted_mutual_info_score(c(0L,0L,0L,1L,1L,1L),c(1L,1L,0L,0L,0L,0L),average_method="arithmetic"))
Sources
- Source 1scikit-learn.org
From the CodeSplash reference, entry EVA011.