twoHelixestwoHelixes Start free

Datasets / Breast cancer diagnostic

Measurements ranked by separation between diagnoses

The gap between the two group means, divided by their pooled spread - the same effect size a statistician would reach for, so measurements in different units can be ranked together.

Question which measurements best separate malignant from benign?
Measurements that separate the diagnoses0123worst_concave_poi…worst_perimetermean_concave_poin…worst_radiusworst_areamean_perimetermean_radiusmean_areaSeparation
Breast cancer diagnostic — 8 rows charted from 569, drawn as a hbar
How it decided
Finding the data52 ms

Breast cancer diagnostic: 569 rows, 31 columns. all thirty measurements, grouped by diagnosis.

Shaping the data10 ms

569 rows in, 8 out across 2 columns. The gap between the two group means, divided by their pooled spread - the same effect size a statistician would reach for, so measurements in different units can be ranked together.

Choosing the chart5 ms

hbar. A ranking of long-named measurements: horizontal bars.

Applying defaults1 ms

Palette, spacing, axis titles and legend placement applied. 0 issues found.

The transformation

This is the code, not a description of it — the chart above was drawn from what it returns, and the notebook download runs the same lines against the same file.

groups = df.groupby("diagnosis")
means, spreads = groups.mean(numeric_only=True), groups.std(numeric_only=True)
effect = (means.loc["malignant"] - means.loc["benign"]).abs() / (
    (spreads.loc["malignant"] + spreads.loc["benign"]) / 2
)
result = (
    effect.sort_values(ascending=False).head(8)
    .rename("separation").reset_index()
    .rename(columns={"index": "measurement"})
)

What it charted

8 rows out of 569, 2 columns. First 8 shown.

measurementseparation
worst_concave_points2.6257
worst_perimeter2.5295
mean_concave_points2.4769
worst_radius2.4757
worst_area2.2674
mean_perimeter2.2155
mean_radius2.1331
mean_area2.0532