Predictive analytics | Transcript
While descriptive analytics provides a historical view of business operations, offering insights into
what has happened, moving to predictive analytics allows businesses to anticipate future trends.
Let's take an example in finance and banking.
Descriptive techniques can show past loan default rates or identify customers with similar credit
profiles.
Predictive tools can leverage past financial records to predict future loan defaults, enabling banks to
make more informed decisions on loan approvals and interest rates.
Similarly, in supply chains and logistics, while descriptive analytics might detail past delivery efficiency,
predictive analytics forecasts future delivery times considering variables like traffic patterns and
weather conditions.
This shift not only improves operational efficiency but also enhances customer satisfaction by
ensuring timely deliveries.
The transition into predictive analytics is powered by supervised machine-learning techniques.
Supervised-learning algorithms allow us to learn a mathematical function that maps a set of input
data to an output, using the former to predict the latter.
For instance, predicting loan defaults based on historical financial data or estimating the box office
results of a movie that is about to be released based on its characteristics, its cast, and the time of the
year.
Within supervised learning, the two primary classes of tasks are classification and regression, which are
distinguished by their output type.
Classification deals with categorising data into predefined groups.
In finance and banking, classification algorithms can identify whether a new applicant will likely default
on a loan: a binary classification problem.
The answer is yes or no.
If the goal, though, is to categorise customers on a more granular scale between zero, low, medium,
or high levels of debt, this would be a multiclass classification problem.
Regression, on the other hand, predicts a continuous quantity for supply chains and logistics.
Regression models can forecast the precise delivery time based on various factors, which leads to
optimised logistics planning.
In this setting, we have a continuous outcome of interest.
Let's delve into the process of developing a predictive machine-learning model.
The first step is that we need to prepare the data.
The journey begins with the collection of labelled data.
In this context, labelled means that for every perceived data point, there is an associated correct
answer or outcome.
For instance, in our banking example, customers can be associated with a label such as 'loan default'
or 'no default' – yes or no.
The second step is feature selection.
Before training, relevant features that are believed to influence the output are selected.
Features are individual measurable properties or characteristics of the phenomenon being observed in
the example of loans.
This could be the demographics of the customer, the history of their past transactions and products
that they bought from the bank.
The third step is to select a model.
The algorithm selected for predictive analytics plays a pivotal role in the model's success, each
offering unique benefits and challenges.
At this point, let's look at the two primary classes of algorithms that we use predictive analytics for.
On the one hand, we have linear models such as linear regression.
These are celebrated for their simplicity and interpretability, making them a staple for problems with
direct proportional relationships between variables.
Their transparency in how input variables affect the output is a key advantage facilitating
understanding and trust amongst stakeholders.
However, their limitation lies in their assumption that each of the characteristics of our data set has a
fixed additive effect to the phenomenon that we're trying to predict.
For example, having defaulted on a loan in the past has the exactly the same impact on our risk of
defaulting, independent of what the value of our other characteristics are, independent of what was
our age, our gender, or our past history of transactions.
This effect is fixed, and it's the same for each of the values that we have fixed in our characteristics.
This inherent assumption can lead to poor performance when the relationships in the data are more
complex or involve interactions between features.
Non-linear models, on the other hand, can capture the complexity in the data.
By modelling these non-linear interactions, they give us more flexibility in how we build our models.
They can be adapted to capture the intricate interactions that linear models cannot.
Their flexibility makes them well suited to fields like marketing, where consumer behaviour can't
always be neatly predicted by a few variables, or in strategic game planning, where numbers and
diverse factors must be considered simultaneously.
In reality, our lives are not linear.
The factors that we attribute to different phenomena are highly complex and highly non-linear, and so
these methods can actually capture that non-linearity.
However, this flexibility can come at the cost of interpretability, as the complex models they build do
not always lend themselves to easy explanation, which is a trade-off when compared to the
transparent nature of linear regression.
Advanced machine learning and artificial intelligence bring us this class of algorithms.
Deep learning, or the widely celebrated neural networks, form a particular type of non-linear machine
learning.
It is the most advanced class within this category of algorithms.
They encompass a group of algorithms whose fundamental building blocks were inspired by our own
neural networks in our brains.
Deep learning models have demonstrated exceptional accuracy in tackling highly complex problems
with massive data sets, becoming the driving force behind image recognition and natural language
processing innovations.
This strength comes from the ability to automatically discover the representation needed for feature
detection or classification from raw data.
This reduces the need for manual feature engineering, which can be labour intensive and requires
domain expertise.
However, deep learning models require substantial data to train effectively and are often described as
'black boxes' due to their lack of interpretability.
The computational demand and training time is also significant, often requiring very expensive and
powerful hardware in order to resolve into the output model.
The choice of the predictive algorithm that you're going to use at the end of the day hinges on the
need for a balance between accuracy and complexity, the amount and type of data available, the
computational resources that you have available, and the need for model interpretability.
Understanding these trade-offs together with your data science teams is crucial in selecting the right
approach for the given business problem.
Now let's go back to our machine learning modelling pipeline.
After we have selected our preferred algorithm, we have to go to Step 4, training the model.
During training, the algorithm iteratively makes predictions on the training data, which are corrected
by the actual labels.
The difference between the prediction and the actual label is calculated using a loss function.
Think of it as a measure of error of our model which the algorithm works to minimise overtime.
This process involves adjusting the parameters or weights of the model and for example, in linear
regression the algorithm would adjust the slope and intercept of the line to reduce the difference
between the predicted and the actual values.
Next step after this process is done is evaluation.
The model's performance is evaluated using a separate part of the data set not seen by the model
during training, known as the testing set.
This helps us assess how well the model has learned to generalise from the training data to unseen
data.
The evaluation metric chosen needs to match the desired target of the predictive model.
For example, if the model predicts whether a customer is going to default on their loan, a desired
evaluation metric would be the percentage of loans that were correctly classified, both for the cases of
default and the cases of no default.
Now, after the model has been evaluated, we need to fine-tune - that's step 6. Based on the model's
performance, further adjustments need to be made.
This can involve tuning the hyperparameters of the algorithm, selecting different features, or trying
different models.
The goal is to improve the model's ability to predict accurately using unseen data. And in most cases
you will see that there is an iterative process between steps 3, 4, 5, and 6 until we identify the best
possible algorithm, the best possible model and the best possible set-up for our problem.
Once this is completed, we move to step 7: deployment.
After the optimisation and the evaluation of our model, we need to deploy it in a real-world
environment and this is most likely the most challenging part in this pipeline.
There we will have to make predictions or decisions based on new unseen data.
And this data might actually change over time.
So you might have to go back to steps 1, 2, 3, 4, 5, 6 to retry this process if the data or the setting
where you want to deploy the algorithm changes.
This concludes our pipeline.
But the one thing that you need to remember is that there is no one solution that fits all.
Finding the right algorithm, deploying it in your setting is a live process that you're going to have to
keep on monitoring as you are developing and deploying your models.