BaşlayınÜcretsiz Başlayın

Train an RF regressor

In the following exercises you'll predict bike rental demand in the Capital Bikeshare program in Washington, D.C using historical weather data from the Bike Sharing Demand dataset available through Kaggle. For this purpose, you will be using the random forests algorithm. As a first step, you'll define a random forests regressor and fit it to the training set.

The dataset is processed for you and split into 80% train and 20% test. The features matrix X_train and the array y_train are available in your workspace.

Bu egzersiz

Machine Learning with Tree-Based Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import RandomForestRegressor from sklearn.ensemble.

  • Instantiate a RandomForestRegressor called rf consisting of 25 trees.

  • Fit rf to the training set.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import RandomForestRegressor
____

# Instantiate rf
rf = ____(n_estimators=____,
            random_state=2)
            
# Fit rf to the training set    
____.____(____, ____) 
Kodu Düzenle ve Çalıştır