In my previous article on Discretisation vs. Monte Carlo, I touched on decision trees—but from the lens of decision analysis, where we model choices under uncertainty.

This article takes a different path. We’ll explore Decision Trees in Machine Learning (ML), a tool not for decision-making under risk, but for learning patterns from data.

Decision tree looks like below


🧠 What is a Decision Tree?

A Decision Tree is a model that learns decision rules from data. It works for both:


🌿 Anatomy of a Decision Tree

Understanding the structure helps explain how decisions are made:

Each path from the root to a leaf is a decision rule.


📏 How Are Trees Built?

At each decision node, we look for the best feature/variable and threshold to split the data, using:

We pick the split that gives us the most “information gain”, i.e. the biggest drop in uncertainty.

What’s “information gain”, you might ask? Let’s demonstrate with a little example of predicting Want to be PE variable as Yes or No based on the 3 variables, Love Math, Love Marvels and Age.

🔶 Step 1: Start with a Mixed Bag

Suppose you have 7 balls:

This bag is fairly mixed → high uncertainty.

✂️ Step 2: Split by a Question (e.g. “Love Marvels?”)

Now, you divide the bag into two smaller bags:

✅ Step 3: Evaluate Purity

After the split:

That means the new groups are less mixed than the original.

→ This reduction in “mixing” is Information Gain.


💻 Python in Practice

Here’s how you’d build and evaluate a regression tree in Python:

Use case: Predicting oil rate from pressure, temperature, and water cut.

Bonus: You can even visualise the tree to see how decisions are made.


🎯 Enter Ensembles: Bagging and Boosting

Single decision trees are prone to overfitting because they can memorise the training data, especially if grown deep with many splits. To solve overfitting and boost accuracy, we combine multiple decision trees.

🌲 Random Forest (Bagging)

🔁 Gradient Boosting


🛢️ Oil & Gas Use Cases

Here are a few ways ML decision trees are applied in our industry:

🧪 Classification Tree

Predicting if a well is experiencing production impairment based on flow rate, tubing pressure, and historical trends.

⚙️ Regression Tree

Estimating daily liquid production from choke size, temperature, and casing pressure.

🌲 Ensemble Methods

Forecasting decline trends or classifying sand-producing wells across large well portfolios.


✅ Why Engineers Like Trees


🚀 Final Thoughts

While decision trees in decision analysis help us make choices under uncertainty, ML decision trees help us uncover data-driven patterns and predictions.

They’re different tools, from different disciplines, and both have their place.