← All simulations · Pillar 1: Numbers & pictures

Percentages & proportions

What it is

A proportion is a part compared to a whole — how big one slice is next to the entire pie. A percent is the most common way to say it: “per hundred,” or how many you’d have if the whole were exactly 100. The very same amount can be written four ways — a count, a percent, a decimal and a fraction — and they all mean the identical share.

Go deeper: to turn a part-of-whole into a percent you divide and multiply by 100: part ÷ whole × 100. Drop the ×100 and you have the decimal; write the part over the whole and simplify and you have the fraction. The magic of a percent is that it scales away the size of the group: 3 out of 5 and 30 out of 50 are both 60%, so percentages let you compare groups that aren’t the same size.

Why care

Machine learning speaks in proportions. Accuracy is “how many right out of all tries.” A probability is a proportion between 0 and 1. Class balance, base rates, precision and recall — all parts over wholes. Reading them as percentages is what lets you compare a model tested on 50 examples with one tested on 5,000, fairly.

The idea, intuitively

Here is a whole of 100 squares. Slide how many are filled and watch the four faces of that amount update together: the count, the percent, the decimal and the simplified fraction. Then bring in a smaller class of 25 filled to the same percent — a different number of squares, but the exact same share. That’s a proportion doing its job.

Peek at the data first

A few familiar amounts, each shown as a part-over-whole, a percent, a decimal and a fraction — four names for one share, the kind of summary Spectra would report about a column.

Try it

Drag Filled squares to colour any number of the 100 squares and watch the count, percent, decimal and fraction change as one. Tick Compare with a class of 25 to fill a smaller whole to the same percent and see a different count carry the identical share.

Where it shows up

Where it came from

The idea of reckoning “per hundred” goes back to ancient Rome, where taxes were levied as fractions of 100. Merchants in Renaissance Italy spread the practice for interest and profit, and the phrase per cento eventually shrank to the symbol % we use today.

Try it in code

In the Studio, scores come back as proportions — check a model and accuracy is just “how many right out of all,” the same part-over-whole you just sliced:

data  = load "fruits"
train, test = split data, hold_out: 20%

model = make_model "classifier"
train_model model, on: train, predict: "type", using: ["sweetness", "size"]

check model, with: test

Open it in the Studio ▶

Check your understanding