Session Ready
Exercise

Am I underfitting?

You are creating a random forest model to predict if you will win a future game of Tic-Tac-Toe. Using the tic_tac_toe dataset, you have created training and testing datasets, X_train, X_test, y_train, and y_test.

You have decided to create a bunch of random forest models with varying amounts of trees (1, 2, 3, 4, 5, 10, 20, and 50). The more trees you use, the longer your random forest model will take to run. However, if you don't use enough trees, you risk underfitting. You have created a for loop to test your model at the different number of trees.

Instructions
100 XP
  • For each loop, predict values for both the X_train and X_test datasets.
  • For each loop, append the accuracy_score() of the y_train dataset and the corresponding predictions to train_scores.
  • For each loop, append the accuracy_score() of the y_test dataset and the corresponding predictions to test_scores.
  • Print the training and testing scores using the print statements.