Playground/ AI & Machine Learning/ Classification Playground
🤖 AI & Machine Learning

Classification Playground

Move the threshold. Watch accuracy, precision and recall trade off in real time.

Predict "high demand" if price is below –
Actual: high demand Actual: low demand Your threshold

"High demand" here means units_sold above the dataset's median: a label defined for this demo, not a business rule.

What is happening?

This is the simplest possible classifier: a single threshold on one feature. Move it lower and you catch fewer high-demand products but with more confidence (higher precision); move it higher and you catch more but with more false alarms (higher recall). There's no single "best" threshold: it depends on which mistake costs more.

Under the Hood
Threshold selection↓Predict positive if price < threshold↓Compared against actual (units_sold > median)

Inputs

  • price, units_sold (20 rows)

Processing

  • Threshold classification
  • Confusion matrix: TP / FP / TN / FN

Output

  • Accuracy, precision, recall
  • Color-coded number line

Technology

  • Vanilla JavaScript

Explore another experiment

More Playground experiments are on the way.