Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

Specifying the decision tree model

Remember we discussed the mapping of categorical features? Use the categorical features info parameter to specify which of the variables are truly categorical, that is, not just mapped to an index.

For our example, Frisked has two levels, so it is specified as 0:2 (the target variable with 2 levels) and Race has 8 levels, so it is specified as 3:8 (the third feature having 8 levels):

Set other parameters appropriate to the decision tree model:

  • numClasses: This applies to the number of outcomes; in our case, it is 2.
  • maxDepth: How deep would you like the decision tree to go? For illustrative purposes, we will set it to 2 levels deep, but for real-world problems, you should attempt to go a bit deeper. Remember, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content