How to use machine learning to predict purchase intent?
There are machine learning algorithms that classify datasets instead of predicting continuous values. Two of them are especially useful in pricing: logistic regression and decision trees. Both are used when aiming to anticipate a binary decision, such as purchasing or not purchasing a product.
MACHINE LEARNINGARTIFICIAL INTELLIGENCE


Predicting purchase intent with logistic regression
Logistic regression, like linear regression and neural networks, relies on large datasets with input variables and an output variable. In pricing, this type of regression allows predicting a customer’s purchase intent under certain conditions.
An example illustrates its usefulness. A gym owner suspects that monthly attendance influences the renewal of the annual subscription. To confirm this, he wants to build a model that anticipates which customers will renew, in order to better target his retention campaigns.
In a sample of 20 customers, attendance and renewal data show no clear linear pattern. Since the output variable is binary—renews or does not renew—a linear regression would be inappropriate.
However, through a mathematical transformation, a linear function can be converted into an S-shaped curve suitable for predicting binary probabilities. The gym owner uses the statistical module in his spreadsheet to obtain the parameters of the logistic regression.
He discovers that those who attend fewer than 7 times per month have a nearly zero probability of renewing. Those who attend 14 times or more have a probability close to 100%.
For those in the intermediate range, the model predicts a probability: if it is below 50%, they are assumed not to renew; if it is equal to or above 50%, they are expected to renew.
Although the example uses only one variable, logistic regression can incorporate many more—such as balances, transactions, or complaints—making it highly useful for modeling purchase behaviors.
But this technique has limitations: it only works well when the relationship between input and output variables is linear. When this is not the case, more advanced methods are needed.
Using decision trees for more complex conditions
When the relationships between variables are not linear, decision trees are a more powerful alternative. They are also used to predict the probability of purchase in more complex contexts.
An example comes from a car dealership where the manager wants to estimate the purchase probability of a new model based on demographic data. He uses a manufacturer’s dataset that includes information on salary, age, marital status, and whether the customer purchased the vehicle.
Given the size of the database, he selects a sample of 20 records and begins exploring it using filters. He finds that no one earning less than $2,000 buys the car. Those earning between $2,000 and $5,000 purchase only if they are over 40 years old. And those earning more than $5,000 buy as long as they are over 40, or if they are single when younger.
This analysis is organized into a decision tree, where the first filter (salary) is the root node because it best separates the dataset. The following conditions are internal nodes, each with branches that represent possible answers. At the end of each path are the leaves of the tree, which indicate the prediction: yes or no.
Although this example was done manually, in practice specialized software is required to automatically identify the most relevant variables and build more complex trees.
However, this flexibility comes at a cost. Decision trees, like neural networks, can suffer from overfitting if they become too complex, with too many nodes and branches.
Conclusion
Both logistic regression and decision trees allow predicting customers’ purchase intent based on historical data and multiple input variables. The choice between one method or the other depends on the complexity of the relationships among variables.
Up to this point, we have seen models that require a known output variable. But what happens when we don’t have one and still want to segment customers?
This will be explored in the next section, where the use of machine learning to segment markets without an output variable is addressed.
