Machine learning (ML) is an approach to building software that learns patterns from data. A training process produces a model, which can then use those patterns to make predictions, organize information, or generate content for new inputs.

You encounter ML when a system filters spam, estimates demand, recommends a product, recognizes speech, or generates a draft. These applications have different objectives and need different ways of checking success. A useful model is one that works on the relevant new cases, rather than only the examples used to build it. Google’s introduction to machine learning

Imagine routing support requests. You could write explicit rules such as “send messages containing this product code to this team.” You could also train a model using examples of previously categorized requests. A real application might combine both: learned classification for varied wording and fixed rules for particular exceptions.

AI, machine learning, and deep learning

These terms describe different levels of the picture:

  • Artificial intelligence is the broader field of building systems that perform tasks associated with intelligence. Some AI systems use explicitly written rules.
  • Machine learning is an approach within AI that learns from data.
  • Neural networks are one family of machine learning models.
  • Deep learning uses neural networks with multiple processing layers to learn useful representations.

Generative AI describes systems that produce content, such as text or images. Modern generative models commonly use deep learning, but much of ML performs other tasks. Forecasting stock requirements or flagging a suspicious transaction does not require a conversational assistant. Continue with neural networks and generative AI for those branches of the subject.

The basic ingredients: examples, features, and labels

Consider a supervised model trained to route requests to Billing, Delivery, or Technical Support.

Term Meaning Support-routing example
Dataset A collection of examples Previous requests with reviewed destinations
Example One observation used for learning or evaluation One request at the time it arrived
Features Information supplied as inputs Request text, selected product, and channel
Label or target The outcome the model is trained to predict The correct destination team
Model The learned mapping used for predictions A classifier that scores possible destinations

Labels can come from reviewed records, measurements, or other processes; they are not automatically correct simply because they exist in a dataset. For the router, a mistaken historical transfer can become a misleading training example. Features must also be available when the real prediction is made. Supervised learning fundamentals

An algorithm is a method used to learn or make predictions. The trained model is the resulting artifact used on new inputs. For example, training a decision tree produces a particular tree; training on another dataset can produce a different one.

The main ways models learn

These approaches describe how the learning signal is supplied. They can be combined across different stages of a system.

Approach Learning signal Example
Supervised learning Examples paired with target outputs Predict a support category from reviewed requests
Unsupervised learning Data without a supplied target for each example Group similar requests to explore recurring themes
Self-supervised learning Targets constructed from the data itself Predict a missing or next text token
Semi-supervised learning A combination of labeled and unlabeled examples Use a small reviewed dataset alongside a larger unlabeled collection
Reinforcement learning Rewards associated with actions and their consequences Learn a policy for choosing actions in a simulated environment

Clustering finds groups; those groups do not arrive with guaranteed business meanings. Reinforcement learning learns action-selection behavior against a reward objective; an ordinary chatbot conversation is not automatically a reinforcement-learning session. Learning approaches

Self-supervised learning still has a target and a loss to optimize. Its distinguishing feature is how the target is obtained, reducing the need to manually label each example. It is widely used to pretrain models that can later be adapted to particular tasks. Dive into Deep Learning: self-supervised learning, semi-supervised learning

What machine learning can do

Classification assigns categories or scores for categories. Regression estimates numerical quantities. Other tasks include grouping, ranking, anomaly detection, and generation.

Task Possible application What a useful check looks like
Classification Route a request to a team Correct destination, including uncommon categories
Regression Estimate weekly demand Error measured in units relevant to planning
Clustering Explore themes in customer feedback Groups are coherent and useful to reviewers
Ranking or recommendation Order relevant help articles Useful material appears near the top
Anomaly detection Flag unusual activity for investigation Important cases are found without excessive false alarms
Generation Draft a summary or response Facts, omissions, and wording meet the task requirements

The same task can be approached using several model families. Linear models, decision trees, ensembles, nearest-neighbor methods, and neural networks offer different tradeoffs. Start with a simple baseline and compare measured results rather than assuming that the most complex model is best. scikit-learn’s estimator overview

From a problem to a working model

A supervised machine learning workflow: define the task and error costs, prepare and split data, train on training data, choose settings using validation data, evaluate on held-out test data, then use and monitor the model on new inputs.

  1. Define the task. Specify the input, expected output, and consequences of mistakes. “Use AI” is not a measurable objective.
  2. Prepare appropriate data. Check accuracy, coverage, permissions, and label consistency. Decide how real future cases should be represented in evaluation.
  3. Separate data by purpose. Use a training set to learn, a validation set to compare settings and candidates, and a held-out test set for final evaluation after those choices.
  4. Train and compare. Fit candidate models and compare them with a simple baseline.
  5. Evaluate the selected approach. Inspect both metrics and actual errors on held-out cases.
  6. Deploy and monitor. Use the model in an application, track outcomes, and review changes in the data or task.

Keeping evaluation data independent helps measure generalization: how well the model handles relevant new examples. Continually tuning against the same test set weakens its value as an independent check. For related records, such as messages from one conversation, keep groups together when splitting data. Forecasting also needs time-aware evaluation that respects what was known at prediction time. Training, validation, and test sets

Training and inference

Training learns or updates a model from data. Inference uses a trained model to process an input. Using a pretrained model lets you start from an existing trained artifact; fine-tuning adapts trainable parameters for a particular objective.

An application can add conversation history or retrieved documents to a request without retraining its model. Feedback can support a later improvement process, but a system only updates its learned behavior through whatever training process has actually been implemented. Read AI inference vs AI training.

A worked example: why accuracy alone can mislead

Suppose a fictional evaluation set has 100 requests: 20 urgent and 80 routine. A rule that marks every request routine is 80% accurate, while finding none of the urgent cases.

Now imagine a classifier produces these results. The counts are invented for teaching, not a benchmark.

Actual category Predicted urgent Predicted routine
Urgent 16 4
Routine 8 72
  • Accuracy: 88 correct predictions out of 100, or 88%.
  • Precision for urgent: 16 truly urgent cases out of 24 flagged, or about 67%.
  • Recall for urgent: 16 found out of 20 urgent cases, or 80%.

Precision asks how often a positive prediction is right. Recall asks how many actual positive cases are found. Here the model misses four urgent requests and sends eight routine ones for urgent review. The acceptability of those errors depends on the service’s requirements and available review capacity. Accuracy, precision, and recall

A score should answer the operational question. For a numerical forecast, an error in hours or units may be more meaningful than classification accuracy. For several categories, inspect each category as well as an overall figure. Choosing evaluation metrics

Common failure modes

Overfitting means fitting training examples too closely while performing poorly on new ones. Underfitting means the model has not adequately captured the relationships needed for the task. Training performance alone cannot tell you that deployment will succeed.

Data leakage gives development or evaluation access to information unavailable in real use. A routing model trained with the final assigned team encoded in its input has been given the answer. Another leak can occur when preprocessing learns from the entire dataset before the train/test split. Learn preprocessing from training data, then apply that same transformation to validation, test, and live inputs. Common ML pitfalls

Other practical limits include incomplete data coverage, inconsistent labels, unfair error patterns, changing input conditions, and costs that exceed the benefit. A model can learn correlations that are predictive without establishing what causes an outcome. When a new product or policy changes the task, re-evaluate rather than assuming previous results still apply.

When is machine learning useful?

ML is worth investigating when patterns vary enough to make explicit rules difficult, relevant data is available, and success can be checked. It can scale repetitive analysis and reveal useful structure in large collections.

Begin with the simplest approach that meets the need. A fixed calculation, database lookup, or small rule set may already solve a clearly defined task. An ML project additionally needs data preparation, evaluation, integration, and ongoing monitoring. Budget for that complete process.

For our support router, a sensible first pilot would propose a destination for a human to review, record corrections, and compare outcomes with the existing routing method. Expanding its responsibility should follow evidence about its actual errors and usefulness.

Check your understanding

Does machine learning always mean a neural network?

No. Neural networks are one model family. Decision trees, linear models, and other methods can also learn from data.

Is 80% accuracy enough for the fictional urgent-request task?

The number alone is insufficient. Predicting routine for every request reaches 80% accuracy but misses all urgent cases. Inspect the relevant error types, precision, recall, and operational consequences.

Does uploading a policy document retrain an assistant?

Ordinarily, it supplies context or material for retrieval. That differs from a training process that updates learned parameters.

Next, explore neural networks for a model family, or natural language processing for the tasks and techniques used with human language.