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

Random forest model

In this exercise, you will use the randomForest() function in the randomForest package to build a random forest model for predicting churn of the customers in the training data set, training_set. The target variable is called Future. You will also inspect and visualize the importance of the variables in the model.

Bu egzersiz, kursun bir parçasıdır

Predictive Analytics using Networked Data in R

Kursa Göz Atın

Egzersiz talimatları

  • Load the randomForest package.
  • Use the set.seed() function with the seed 863.
  • Build a random forest using the function randomForest() and all the variables in training_set. The response variable Future needs to be a factor, so utilize the as.factor() function.
  • Plot the variable importance of the random forest model using varImpPlot().

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Load package
___(randomForest)

# Set seed
set.seed(___)

# Build model
rfModel <- ___(as.factor(___)~. ,data=training_set)

# Plot variable importance
varImpPlot(___)
Kodu Düzenle ve Çalıştır