Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Training Systems Using Python Statistical Modeling

You're reading from   Training Systems Using Python Statistical Modeling Explore popular techniques for modeling your data in Python

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781838823733
Length 290 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Curtis Miller Curtis Miller
Author Profile Icon Curtis Miller
Curtis Miller
Arrow right icon
View More author details
Toc

Decision trees

Let's take a look at decision trees, another intuitive classifier. In this section, we will see how decision trees make predictions. We will discuss important decision tree hyperparameters, and when decision trees may go awry. While we do this, I will demonstrate decision trees by using them to predict who did or did not survive the sinking of the Titanic.

A decision tree is a classification algorithm that asks a series of true or false questions. It uses those questions to decide how to classify a data point. Decision trees are implemented using the scikit-learn object DecisionTreeClassifier. Let's go over this now:

  1. The first thing we will do is load in the Titanic dataset, along with some useful functions:
  1. Then, we will load in the first few rows of the Titanic dataset with pandas, as follows:
  1. We're also going to see the first few rows of...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image