Member-only story

Python Decision Tree Classifier Example

randerson112358
6 min readJun 7, 2019

--

Make Golf Predictions Using A Decision Tree

In this article I will use the python programming language and a machine learning algorithm called a decision tree, to predict if a player will play golf that day based on the weather (Outlook, Temperature, Humidity, Windy).

Decision Trees are a type of Supervised Learning Algorithms(meaning that they were given labeled data to train on). The training data is continuously split into two more sub-nodes according to a certain parameter. The tree can be explained by two things, leaves and decision nodes. The decision nodes are where the data is split. The leaves are the decisions or the final outcomes. You can think of a decision tree in programming terms as a tree that has a bunch of “if statements” for each node until you get to a leaf node (the final outcome).

Decision Tree Pros:

  1. Simple to understand and to interpret
  2. List Requires little data preparation

Decision Tree Cons:

  1. Prone to over-fitting
  2. Decision trees can be unstable (a small variation in the data may result in a completely different tree being generated)

If you prefer not to read this article and would like a video representation of it, you can…

--

--

Responses (2)