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?

  1. K-nearest neighbors (k-NN) Source Reference Answer
  2. K-mean
  3. Autoregressive Integrated Moving Average (ARIMA)
  4. Linear regression

Community Votes

A
100%

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)

Jessiii 👍 1 Selected: A
k-NN: This is a classification algorithm that predicts the class of a new data point by comparing it to the closest data points in the training set. In this case, the new data point would be a new flower with measured petal and sepal dimensions, and the algorithm would find the flowers in the training set that are most similar to it based on these features.
Moon 👍 4 Selected: A
The practitioner wants to classify flowers based on measurements. This indicates a classification problem. A. K-nearest neighbors (k-NN): This is a classification algorithm that classifies data points based on the majority class among their k-nearest neighbors. It's suitable for this scenario. B. K-means: This is a clustering algorithm used for unsupervised learning. It groups data points into clusters based on similarity, but it doesn't perform classification with predefined labels. C. Autoregressive Integrated Moving Average (ARIMA): This is a time series forecasting model used for predicting future values based on past data trends. It's not suitable for classification based on static measurements like flower dimensions. D. Linear regression: This is a regression algorithm used for predicting continuous values. It's not suitable for classification into discrete categories like flower types. Therefore, A. K-nearest neighbors (k-NN) is the appropriate algorithm for this classification task
may2021_r 👍 1 Selected: A
The correct answer is A. K-nearest neighbors (k-NN) is a classification algorithm suitable for predicting the classification of flowers based on the provided features.
aws_Tamilan 👍 1 Selected: A
For a classification task where the goal is to predict the type of flower based on several features, K-nearest neighbors (k-NN) is the most appropriate algorithm.
ap6491 👍 1 Selected: A
K-nearest neighbors (k-NN) is a supervised learning algorithm commonly used for classification tasks. It works by finding the "k" closest data points (neighbors) to a given input and assigning the class based on majority voting among these neighbors. In this case, the AI practitioner wants to classify flowers based on features like petal length, petal width, sepal length, and sepal width, making k-NN a suitable algorithm.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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 →

← Back to AIF-C01 Study Guide