Train and test split data with features


Load the Iris dataset from sklearn. Split the dataset into training and testing parts. Pick 2 of the 4 features.
I write this code:

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split

iris = load_iris()
X, y =,

But I didn’t understand "Pick 2 of the 4 features". Is that means test_size and random_state? Or is it something different?


Iris dataset has petal length,petal width,sepal length,sepal width as 4 features.
Pick 2 of the 4 feature means take two of those 4 features in your training model.
I don’t know why you want to do that as using all four feature makes model more accurate

Answered By – Sagun Devkota

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.