ComeçarComece de graça

Set parameters and fit a model

Predictive tasks fall into one of two categories: regression or classification. In the candy dataset, the outcome is a continuous variable describing how often the candy was chosen over another candy in a series of 1-on-1 match-ups. To predict this value (the win-percentage), you will use a regression model.

In this exercise, you will specify a few parameters using a random forest regression model rfr.

Este exercício faz parte do curso

Model Validation in Python

Ver curso

Instruções do exercício

  • Add a parameter to rfr so that the number of trees built is 100 and the maximum depth of these trees is 6.
  • Make sure the model is reproducible by adding a random state of 1111.
  • Use the .fit() method to train the random forest regression model with X_train as the input data and y_train as the response.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Set the number of trees
rfr.____ = ____

# Add a maximum depth
rfr.____ = ____

# Set the random state
rfr.____ = ____

# Fit the model
rfr.____(____, ____)
Editar e executar o código