September 2019
Intermediate to advanced
420 pages
10h 29m
English
What I haven't told you yet is how you pick the features along which to split the data. The preceding root node split the data according to Na <= 0.72, but who told the tree to focus on sodium first? Also, where does the number 0.72 come from anyway?
Apparently, some features might be more important than others. In fact, scikit-learn provides a function to rate feature importance, which is a number between 0 and 1 for each feature, where 0 means not used at all in any decisions made and 1 means perfectly predicts the target. The feature importances are normalized so that they all sum to 1:
In [27]: dtc.feature_importances_Out[27]: array([ 0. , 0. , 0. , 0.13554217, 0.29718876, 0.24096386, 0. , 0.32630522, ...
Read now
Unlock full access