Tabular Modeling Deep Dive
Categorical Embeddings
Beyond Deep Learning
The Dataset
Kaggle Competitions
Look at the Data
Decision Trees
Handling Dates
Using TabularPandas and TabularProc
Creating the Decision Tree
Categorical Variables
Random Forests
Creating a Random Forest
Out-of-Bag Error
Model Interpretation
Tree Variance for Prediction Confidence
Feature Importance
Removing Low-Importance Variables
Removing Redundant Features
Partial Dependence
Data Leakage
Tree Interpreter
Extrapolation and Neural Networks
The Extrapolation Problem
Finding Out-of-Domain Data
Using a Neural Network
Sidebar: fastai's Tabular Classes
End sidebar
Ensembling
Boosting
Combining Embeddings with Other Methods
Conclusion: Our Advice for Tabular Modeling
Questionnaire
What is a continuous variable?
What is a categorical variable?
Provide two of the words that are used for the possible values of a categorical variable.
What is a "dense layer"?
How do entity embeddings reduce memory usage and speed up neural networks?
What kinds of datasets are entity embeddings especially useful for?
What are the two main families of machine learning algorithms?
Why do some categorical columns need a special ordering in their classes? How do you do this in Pandas?
Summarize what a decision tree algorithm does.
Why is a date different from a regular categorical or continuous variable, and how can you preprocess it to allow it to be used in a model?
Should you pick a random validation set in the bulldozer competition? If no, what kind of validation set should you pick?
What is pickle and what is it useful for?
How are
mse,samples, andvaluescalculated in the decision tree drawn in this chapter?How do we deal with outliers, before building a decision tree?
How do we handle categorical variables in a decision tree?
What is bagging?
What is the difference between
max_samplesandmax_featureswhen creating a random forest?If you increase
n_estimatorsto a very high value, can that lead to overfitting? Why or why not?In the section "Creating a Random Forest", just after <<max_features>>, why did
preds.mean(0)give the same result as our random forest?What is "out-of-bag-error"?
Make a list of reasons why a model's validation set error might be worse than the OOB error. How could you test your hypotheses?
Explain why random forests are well suited to answering each of the following question:
How confident are we in our predictions using a particular row of data?
For predicting with a particular row of data, what were the most important factors, and how did they influence that prediction?
Which columns are the strongest predictors?
How do predictions vary as we vary these columns?
What's the purpose of removing unimportant variables?
What's a good type of plot for showing tree interpreter results?
What is the "extrapolation problem"?
How can you tell if your test or validation set is distributed in a different way than your training set?
Why do we ensure
saleElapsedis a continuous variable, even although it has less than 9,000 distinct values?What is "boosting"?
How could we use embeddings with a random forest? Would we expect this to help?
Why might we not always use a neural net for tabular modeling?
Further Research
Pick a competition on Kaggle with tabular data (current or past) and try to adapt the techniques seen in this chapter to get the best possible results. Compare your results to the private leaderboard.
Implement the decision tree algorithm in this chapter from scratch yourself, and try it on the dataset you used in the first exercise.
Use the embeddings from the neural net in this chapter in a random forest, and see if you can improve on the random forest results we saw.
Explain what each line of the source of
TabularModeldoes (with the exception of theBatchNorm1dandDropoutlayers).