Which algorithm predicts flower classification based on petal and sepal measurements?
An AI practitioner wants to predict the classification of flowers based on petal length, petal width, sepal length, and sepal width. Which algorithm meets these requirements?
Community Votes
100% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests your ability to distinguish between supervised classification, unsupervised clustering, time-series forecasting, and continuous regression tasks based on the problem description.
This question tests the ability to select the correct machine learning algorithm for a supervised classification task using the classic Iris dataset features. The community unanimously agrees that K-nearest neighbors (k-NN) is the appropriate choice for predicting discrete flower classes based on continuous numeric features.
Candidates often confuse K-means (clustering) with K-nearest neighbors (classification) due to the similar naming, or incorrectly choose linear regression when they fail to recognize that the target variable is a discrete class label rather than a continuous numeric value.
Community Discussion (5 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Understanding the Problem Type
The scenario describes predicting the classification of flowers (a discrete category, such as species) based on four continuous input features: petal length, petal width, sepal length, and sepal width. This is the classic Iris dataset problem, which is a textbook example of a supervised classification task.
Why K-nearest neighbors (k-NN) is Correct
K-nearest neighbors (k-NN) is a supervised learning algorithm specifically designed for classification (and regression) tasks. It works by:
1. Measuring the distance between the new data point and all points in the training set. 2. Selecting the k closest neighbors. 3. Assigning the class based on majority voting among those neighbors.
Since the goal is to assign a flower to a known species category based on its measurements, k-NN is a perfect fit.
Why the Other Options are Wrong
- B. K-means: This is an unsupervised clustering algorithm. It groups data into clusters without any prior knowledge of class labels. Since we already know the flower species in the training data and want to predict a known class, this is the wrong paradigm.
- C. ARIMA: This is a time-series forecasting algorithm used to predict future values based on past temporal data. Flower measurements are not time-dependent sequential data, making this entirely irrelevant.
- D. Linear regression: This algorithm predicts a continuous numeric value (e.g., price, temperature). Because the output here is a discrete class label (flower species), regression is not appropriate.
Community Consensus
The community voted 100% for option A, with multiple users confirming that the keyword "classify" immediately signals a classification algorithm like k-NN.
Official Reference
Exam Strategy
When you see the word 'classify' or 'predict the class' in an exam question, immediately eliminate regression, time-series, and clustering options. Focus only on supervised classification algorithms like k-NN, decision trees, or logistic regression.
Related Analysis
Practice All AIF-C01 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AIF-C01 Practice Test →