AstraAI

Machine learning

Can a computer tell two flowers apart?

In the curriculum:ClassificationSee the map โ†’
๐ŸŽ“ School maths ยท Years 9โ€“10Statistics โ€” Read a scatter of two features and separate the groups.Maths by year โ†’

The Case. Given just a flower's petal measurements, can a computer guess its species โ€” after only ever seeing examples, never being told the rules? That's machine learning โ€” the same idea behind an app that names a plant from a photo โ€” and you're about to train one for real.

Your tools. scikit-learn is a real AI toolkit. We train a model on most of the flowers, then test it on ones it has never seen.

Investigate. Press Run (the AI library loads the first time โ€” give it a moment). It prints how often the computer guessed right.

  • Why do we hold back test data instead of testing on what it learned?
  • Change n_neighbors โ€” does the score change?

This case is part of the Family plan

Unlock every 12โ€“15 case and the full AI, machine-learning, and deep-learning path โ€” one subscription for the whole family.

Need a hint?

train_test_split holds back 30% so we can test the model on flowers it never trained on โ€” that's how we know it really learned.