Computer scienceData scienceInstrumentsScikit-learnTraining ML models with scikit-learnClassification in scikit-learn

Decision tree with scikit-learn

Load Iris

Report a typo

Below you find a code snippet that loads the Iris dataset and splits it into two sets. Insert the code snippet in your code editor, create a classifier with random_state=42 and fit the classifier on the train data and find the score for the test data (by using clf.score()).

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

X, y = load_iris(return_X_y=True)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
Enter a number
___

Create a free account to access the full topic