How to interpret the output array?

QuestionsQuestions8 SkillsProDec, 10 2025
060

That's a great question, Labby is here to help!

You've likely just run python3 main.py with the updated code, and now you see an array of numbers like [0 0 0 ... 1 1 1 ... 2 2 2]. This array is the iris.target.

Here's how to interpret it:

  • What it represents: This array contains the species (flower type) for each of the 150 Iris flowers in the dataset. These are the "labels" or "target variables" that a supervised machine learning model would try to predict.
  • Encoding: The species are encoded as integers:
    • 0 represents the Iris Setosa species.
    • 1 represents the Iris Versicolor species.
    • 2 represents the Iris Virginica species.
  • Order: The target array is ordered to correspond with the iris.data array. This means the first 0 in iris.target is the species for the first flower's measurements in iris.data, and so on.

You'll notice that the array typically shows 50 zeros, followed by 50 ones, and then 50 twos. This indicates that the Iris dataset is conveniently ordered, with all flowers of one species listed first, then all of the second, and finally all of the third.

Do these explanations help clarify the iris.target output for you?

0 Comments

no data
Be the first to share your comment!