Machine Learning

Machine learning for business analytics: start with the decision, then the model

Plan a useful machine learning project for business analytics: define a decision, compare a rule, choose data and evaluate errors with a worked example.

Machine learning for business analytics uses patterns in past data to support a business decision, such as planning stock, prioritising a review queue or estimating demand. A useful project specifies the decision and measures improvement over the current process. A prediction score by itself does not show that changing the process helps.

This guide is for a learner planning a first analytics project. It uses a fictional stationery shop, with invented quantities and costs so the arithmetic can be checked. It is not a case study or a promised return from a course.

Turn an analytics question into a prediction task

"Use AI to improve stock" is too broad to evaluate. A more useful brief is: predict next week's notebook demand for each shop, using only information known when its order is placed. The store manager uses that prediction to choose an order quantity.

Part of the briefA concrete choiceWhy you need it
DecisionWeekly notebook orderDefines what changes after prediction
RowOne shop-weekSets the unit of observation
TargetUnits demanded in the following weekDefines the numerical outcome
InputsEarlier demand, known promotions and calendar informationMakes prediction timing explicit
BaselineRepeat last week's quantityRepresents a simple alternative
EvaluationLater weeks kept out of fittingTests a future-facing use case
ReviewShortage and surplus counts by shopConnects error to operations

Recorded sales can understate demand when a shop runs out. Before treating sales as the target, identify stockouts and decide what the available data can support. No model can recover unobserved demand simply because a column is named demand.

Work through a small decision example

Suppose true demand in a held-out teaching example is 30 notebooks. The old rule orders 20; a model recommends 35. Under our simplified assumptions, an unfilled unit has a penalty of 4 and an extra unit has a penalty of 1.

ApproachOrderShortageSurplusIllustrative penalty
Existing rule2010010 × 4 = 40
Model recommendation35055 × 1 = 5

The rule's absolute error is 10 units; the model's is 5. Here the model also has the lower illustrative penalty. But one week cannot establish a reliable improvement. Real ordering can involve carryover stock, delivery lead times, minimum order sizes and uncertain demand.

The example shows why you should record the consequences as well as error. If surplus were much more costly, the preferred order could change. The prediction is one input to the ordering policy, and a policy can apply buffers or limits before anyone acts.

Try it yourself: change the shortage penalty to 1 and the surplus penalty to 10. The old rule has penalty 10; the model recommendation has penalty 50. Explain why the same predictions lead to a different preference under these assumptions.

Choose an approach you can compare

QuestionCandidate approachFirst comparison
How many units next week?Regression or a forecasting methodLast week or a seasonal rule
Which support requests need review?Classification or a ranking scoreExisting triage rule
Which shops behave similarly?ClusteringA simple grouping by known attributes
Which transactions are unusual?Outlier detectionValidation rules and fixed thresholds

These are different tasks. A clustering result does not automatically predict demand, and an unusual transaction is not automatically an error. Read predictive analytics, unlabeled data and outlier detection for worked examples of those distinctions.

For a first forecasting project, a simple model with a clear target and evaluation is easier to learn from than a complicated model with an ambiguous target. Add complexity only after inspecting the baseline's mistakes.

Build a data and evaluation checklist

First, write down when every column becomes available. A final weekly sales total cannot be an input to a prediction made before that week begins. Promotions are usable only if they were genuinely known at ordering time.

Next, check what rows are missing. A closed shop, a missing upload and a zero-demand week should not silently become the same value. The pandas project on daily trends shows why a missing date differs from a recorded zero.

Then separate fitting, model selection and final evaluation. Compare the model and baseline on the same dates, shop groups and outcome definition. Report errors by relevant subsets so a good average does not hide consistently poor results at a small shop.

Finally, define the review process before automated action. A manager should be able to identify unavailable inputs, implausible recommendations and changes in stock policy. Record overrides so you can examine whether a later evaluation still represents the process being used.

Common questions

Is machine learning required for business analytics?

No. Descriptive tables, queries, charts and explicit rules can answer many useful questions. ML becomes relevant when a prediction or pattern-finding task has suitable data and a way to evaluate its usefulness.

Which model should a beginner learn first?

For a numerical target, a mean baseline and a simple regression are a useful starting comparison. The linear regression tutorial gives a runnable arithmetic example before you attempt a business dataset.

Does a lower prediction error guarantee a better business outcome?

No. The action, constraints and consequences matter. The ordering example demonstrates this by changing only the penalties. An operational comparison also needs representative outcomes and enough observations to assess variation.

Learn the workflow in Python

Start with SchoolWhool's pandas module for cleaning and joining tables, and the Statistics course for variation, comparisons and uncertainty. The Python project articles are a practical first step if writing scripts is new.

Then use the Machine Learning course to plan model study, checking which lessons are published. A free account adds quizzes and progress. Pro adds practice for every lesson, projects, certificates and weekly live sessions with Gaurav.

Further reading

For evaluation designs, see scikit-learn's official time-series split example. The shop, predictions and penalty calculations above are original teaching examples.

Related course

Classical machine learning, completely: regression and gradient descent, classifiers and evaluation, trees and ensembles, clustering, dimensionality reduction, and putting models into production.

Open lessons' parts and key terms are free to read, with no account.

What you will be able to do

  • Build regression and classification models from scratch.
  • Understand the calculus and optimisation behind how models learn.
  • Evaluate models properly and spot overfitting.
  • Use trees, ensembles and clustering on real data.