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

Random forest in scikit-learn

Not enough objects

Report a typo

Let's practice in critical conditions: we have a small dataset. As already mentioned in the topic, some objects can never occur in any OOB sample and the model does not give OOB predictions for them.

Let's look at how it happens. Follow these steps:

  1. Load the iris flower dataset.
  2. Split data into train and test sets using train_test_split function with the following parameters: test_size=0.5 , random_state=17.
  3. Create an instance of RandomForestClassifier model with the following parameters: n_estimators=5, max_features=2, random_state=17, oob_score=True. Then, fit it with the train set.
  4. Examine the content of the oob_decision_function_ attribute of the model for the presence of nan values.

Your task is to write the number of objects that have no OOB prediction.

Enter a number
___

Create a free account to access the full topic