Applying stacking to predict app ratings
In this exercise you'll start building your first Stacking ensemble. The dataset you'll use is the first one we used in Chapter 1. If you recall, the objective is to predict the rating of each app (from 1 to 5). The input features we use are: Reviews, Size, Installs, Type, Price, and Content Rating.
We already did step 1: prepare the dataset. It is available to you as apps. We cleaned the required features and replaced missing values with zeros.
Now, you'll work on step 2: build the first-layer estimators.
Este exercício faz parte do curso
Ensemble Methods in Python
Instruções do exercício
- Build and fit a decision tree classifier with:
min_samples_leaf: 3andmin_samples_split: 9. - Build and fit a 5-nearest neighbors classifier using:
algorithm: 'ball_tree'(to expedite the processing). - Evaluate the performance of each estimator using the accuracy score on the test set.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Build and fit a Decision Tree classifier
clf_dt = ____(____, ____, random_state=500)
clf_dt.____
# Build and fit a 5-nearest neighbors classifier using the 'Ball-Tree' algorithm
clf_knn = ____
clf_knn.____
# Evaluate the performance using the accuracy score
print('Decision Tree: {:0.4f}'.format(accuracy_score(____)))
print('5-Nearest Neighbors: {:0.4f}'.format(accuracy_score(____)))