Skip to content
AI & MLbeginner

What is machine learning?

Updated Nov 30, 20263 min readBased on official documentation
What is machine learning?

In short

Machine learning is a way of building software that learns patterns from data instead of following hand-written rules. You show a program many examples, and it adjusts itself to make better predictions. It is a core part of modern artificial intelligence, used for spam filters, recommendations and image recognition.

How it works

Traditional software follows rules that a programmer writes by hand. Machine learning flips this idea. You give the program a large set of examples, and it finds the rules on its own. Each example usually has input features, such as the size of a house, and sometimes a label, such as its sale price. The program studies these pairs and builds a model, which is a piece of code with adjustable numbers called parameters.

Training is the step where the model adjusts those numbers. The program makes a guess, measures how wrong the guess is, and changes the parameters a little to reduce the error. It repeats this many times. A common method for doing this is gradient descent, which you can read about on our gradient descent page.

Once training is done, you use the model on new inputs it has never seen. This step is called inference. The model returns a prediction, such as a likely price or a category.

Main types of learning

Most machine learning falls into a few broad groups. The right group depends on what data you have.

  • Supervised learning uses labeled examples. The model learns to map inputs to known answers. Spam detection and price prediction are typical cases.
  • Unsupervised learning uses data with no labels. The model looks for structure, such as groups of similar customers.
  • Reinforcement learning teaches an agent to act by rewarding good outcomes and penalizing bad ones. The agent learns through trial and error.

The documentation we used is a glossary of terms from Google's machine learning materials. It covers these areas and many more, including evaluation metrics and fairness. Terms such as accuracy describe how well a model's predictions match the correct answers. Accuracy is simply the number of correct predictions divided by the total number of predictions.

A simple example

Imagine you want a program to tell whether an email is spam. You collect thousands of emails and mark each one as spam or not spam. The model reads the words and other features of each email and learns which patterns usually signal spam. After training, you test it on emails it has not seen before. If it labels most of them correctly, you can use it in your mail app.

Accuracy alone can mislead you. Suppose only one email in a hundred is spam. A model that labels every email as not spam would be 99% accurate and still useless. For this reason, teams often look at other metrics as well. Our confusion matrix page explains a helpful way to see the different kinds of mistakes.

Common mistakes

Beginners often make a few predictable errors. The first is using too little data, which makes it hard for the model to find real patterns. The second is testing the model on the same data it trained on. This hides the real performance, because the model may have memorized the examples. Always keep a separate test set. The third mistake is training a model that is too closely fitted to the training data. This problem is called overfitting, and you can learn more on our overfitting page.

Another common issue is poor data quality. If the labels are wrong or the examples do not represent the real world, the model will learn the wrong lessons. Good machine learning depends on careful data preparation as much as on the algorithm.

Where to start

You do not need advanced mathematics to try machine learning. Many developers start with Python and a library that provides ready-made algorithms. Work on a small dataset, split it into training and test parts, and compare a few simple models. Once you are comfortable with the basics, you can explore more complex approaches. Deep learning uses neural networks with many layers, and you can read about them on our neural network page and our deep learning page.

The key idea to remember is simple. Machine learning builds models from examples, and the quality of those examples shapes the quality of the model.

FAQ

Do I need to be good at math to learn machine learning?

Basic knowledge of statistics and linear algebra helps, but you can start with high-level libraries and learn the math as you go. Many developers learn by building small projects first.

What is the difference between machine learning and AI?

Artificial intelligence is the broad goal of making machines act intelligently. Machine learning is one way to reach that goal, where systems learn patterns from data instead of following fixed rules.

How much data do I need to train a model?

It depends on the problem. Simple tasks may work with a few hundred examples, while complex tasks often need thousands or more. Clean, representative data matters more than sheer volume.

What is a label in machine learning?

A label is the correct answer attached to an example, such as whether an email is spam. Supervised learning relies on labels to teach the model what to predict.

Sources

This page is based on the official documentation below. Read it for full detail.

Machine learning — official documentation ↗
blozhikDeveloper news from across the web, explained. Every story links to its original sources.