To get a more objective evaluation of the RF model used in the topic, we can make another train and test sets and calculate the metric again.
In order to do it, follow these steps:
-
Load the iris flower dataset.
-
Split data into train and test sets using
train_test_splitfunction with the following parameters:test_size=0.4,random_state=182. -
Create an instance of
RandomForestClassifiermodel with the following parameters:n_estimators=15,max_features=2,oob_score=True,random_state=127. Then, fit it on the train set. -
Get the accuracy score of your model by calling the
.score()method on the test data.
Insert the output in the answer field. Round it to three digits after the decimal point.
Tip: To load and split the dataset, just copy the code below:
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=182)