What Is Machine Learning (ML)? Definition and Examples

How can computers learn without being explicitly programmed? This is the core question that drives the growing field of machine learning (ML), a type of artificial intelligence that is increasingly integrated into our daily lives.

While ‘machine learning’ is a buzzword, many people don’t fully grasp what exactly it means. How do machine learning algorithms work? What role does machine learning play in AI? Even systems designed to think in purely mathematical terms can take on human-like traits, including bias, when left unchecked.

We will explore the fundamental question, “What is ML?” by providing insight into how machine learning works, its development, and what the future holds for this evolving technology.

Key Takeaways

  • Machine learning is a subset of AI concerned with training models to allow computers to mimic human thought and decision making without explicit programming.
  • The most common types of ML are supervised learning (learning via labeled data), unsupervised learning (learning via unlabeled data), and reinforcement learning (learning via a reward and punishment response).
  • While ML drives powerful benefits like automation, advanced pattern recognition, and personalization, it also has risks, including algorithmic bias and data privacy concerns.

Table of Contents

Definition of Machine Learning

Machine learning (ML) is concerned with training models to allow computers to mimic human thought and decision making without explicit programming.

Using statistical methods, computers analyze datasets and identify patterns within them to predict outcomes or produce outputs (view a visual of machine learning via R2D3). Through model training using techniques like gradient descent and hyperparameter tuning, we optimize these predictions.

Machine Learning (ML) vs. Artificial Intelligence (AI)

Machine learning and artificial intelligence (AI) are closely related: ML is a subset of artificial intelligence and is the driving technical force behind most modern AI systems.

AI is the umbrella term including any technique dedicated to trying to perform tasks typically associated with human intelligence.

Machine learning can be considered a sub-field of AI and is dedicated to developing systems that extract patterns from data.

Develop Machine Learning Skills Online

Get your master’s in information and data science and earn a certificate
from the UC Berkeley School of Information (I School).

Learn About Our Online Graduate Programs

How Does Machine Learning Work?

Traditional programming can be thought of like baking — a recipe, or “program,” details the specific ingredients and step-by-step instructions used to achieve the desired output. Now, imagine writing step-by-step instructions for complex tasks such as “recognize the written letter” or “predict what TV shows this user would enjoy.” These are difficult or time-consuming to describe to a computer.

With machine learning, computers teach themselves the instructions. The computer studies training data, identifies patterns and relevant parameters, and uses those inferences to test its predictions on new data it hasn’t studied before.

With each iteration of this process, the error rate is reduced until the error rate is sufficiently low.

Three Components of a Machine Learning Model

There are a variety of different ML model architectures and types. However, the typical supervised machine learning algorithm consists of roughly three components:

1. A Decision Process

A decision process is a recipe of calculations or other steps that takes in the data and “guesses” what kind of pattern your algorithm is looking to find.

2. An Error Function

An error function is a method of measuring how good the guess was by comparing it to known examples (when they are available). Did the decision process get it right? If not, how do you quantify “how bad” the miss was?

3. An Updating or Optimization Process

An updating or optimization process is a method in which the algorithm looks at the miss and then updates how the decision process comes to the final decision, so next time the miss won’t be as great.

Example of How ML Models Work

For example, if you’re building a movie recommendation system, you can provide information about users and their watch history as the training data. The algorithm will take that input and learn how to return an accurate output: movies that users will “enjoy” (e.g., rate highly or watch all the way through).

Some inputs could be:

  • Movies users watched and rated highly
  • Percentage of movies users watch in each genre
  • Whether a user favors a certain actor or director
  • Time of day that certain movies are watched

The algorithm’s job is to adjust the weights to map the input to the output and minimize the errors. If the algorithm gets it right, the weights it used stay the same. If it gets a movie wrong, the weights that led to the wrong decision get adjusted so it’s less likely to make that kind of mistake again.

The machine learning algorithm processes the training set, the set of training examples, autonomously, aiming to reduce the error rate as it learns from the data it analyzes. This iterative nature of learning is both unique and valuable because it occurs without human intervention — empowering the algorithm to uncover hidden insights without being specifically programmed to do so.

Types of Machine Learning and Algorithms

Machine learning approaches can be categorized by how they learn: labeled data, unlabeled data, or reward-based feedback. Each suits different problems and data constraints.

According to IBM, there are a few different types of machine learning:

Supervised Learning

In supervised learning, the training dataset is labeled and classified for the algorithm. You can think of this as providing the computer with an answer key; the algorithm maps between the inputs and correct outputs to learn. Then, it tests this mapping on a new dataset and checks its answers against another set of labels.

Supervised learning can be used for classification, which predicts categorical outputs, or regression, which predicts continuous values.

Some examples of supervised learning algorithms include:

Linear Regression

Linear regression is an algorithm used to analyze the relationship between independent input variables and at least one, continuous target variable. For example, given data on the neighborhood and property, can a model predict the sale value of a home? Linear relationships occur when the data being observed tends to follow a straight line, plane or hyperplane — and as such, this model can be used to observe whether a target value is expected to increase, decrease, or stay the same relative to some independent variable, such as “number of rooms” or “square footage”.

Machine learning algorithms can be used to learn this linear mapping between inputs and outputs. Independent variables and target variables can be given to a linear regression machine learning algorithm, and the algorithm will then find the coefficients that best fit a line (plane, or hyperplane) to the data. In other words, the linear regression models attempt to map a straight line, or a linear relationship, through the dataset.

Logistic Regression

Logistic regression is a supervised learning algorithm that is used for classification problems to  predict whether a binary event will occur. For example, given an email, a model predicts whether the contents are spam or not.

Logistic regression models can be used to determine categorical outcomes. Given input values, using the model’s weights and biases, the logistic regression will output a value between 0 and 1. The value, when compared to a threshold, will be used to predict the outcome.

Decision Trees

Decision trees are data structures with nodes that are used to test against some input data. The input data is tested against the nodes down the tree to attempt to produce the correct, desired output at the leaves. They are easy to visually understand due to their tree-like structure and can be designed to classify the instance or predict a value (such as the price of a house).

Random Forest

Random forest models are capable of classifying data using a variety of decision tree models all at once. Like decision trees, random forests can be used to predict the classification of categorical variables or the regression of continuous variables. The random forest algorithm generates a number of decision trees as specified by the user, forming what is known as an ensemble. Each tree then makes its own prediction based on some input data, and the random forest machine learning algorithm then makes a prediction by combining the predictions of each decision tree in the ensemble.

Unsupervised Learning

Unsupervised learning uses unlabeled data to train models. The algorithm identifies hidden patterns and relationships throughout the data without an intended output. This is like studying without an answer key or study guide, and instead reading the given material and self-identifying what is important or connected.

A typical example of this type of algorithm is clustering algorithms.

Clustering

Clustering algorithms identify natural groupings in data based on their similarities or differences. This is often done using similarity or distance measures, which are mathematical representations of how alike two data points are. In some forms of clustering, each group is centered around the mean of its members. Other clustering algorithms emphasize data density or connections between data points.

Clustering is particularly helpful to find hidden patterns and simplify complex datasets. For example, it can be used for market segmentation to help identify different customer types for a business.

Semi-supervised Learning

Semi-supervised learning is a hybrid approach in which the dataset contains both labeled and unlabeled data, guiding the algorithm on its way to making independent conclusions. The combination of the two data types in one training dataset helps ML algorithms minimize the prediction error, while using less labeled data.

This kind of ML is most helpful when collecting labeled data is particularly expensive or labor-intensive

Self-training

In the self-training method, an ML model is first trained on a small labeled dataset. With each subsequent iteration on unlabeled data, the model uses the most confident predictions as the ‘ground truth’ and adds them to the training data set. The process is repeated until it reaches peak performance.

Reinforcement Learning

Reinforcement learning uses a reward and punishment system, offering feedback to the algorithm to learn from its own experiences by trial and error. The machine interacts with an environment of some sort, such as a robot operating in a manufacturing environment or a computer learning to play chess.

In model-based reinforcement learning methods, a model of the environment predicts outcomes and simulates potential results before assigning reinforcement. In model-free methods, the agent learns a policy or value function directly from experience without building an explicit model of how the environment works.

One example of a reinforcement learning algorithm is Q-learning:

Q-learning

In Q-learning, the agent interacts with the environment without a model and is guided by feedback from the system. An internal table documents specific actions the agent can take and how correct, or rewarding, each of those actions is given a specific state. Over time, the table is updated based on continuous feedback.

What Are Deep Learning and Neural Networks?

Neural networks are artificial intelligence algorithms that are loosely inspired by the biological neurons in the human brain. These neural networks are used to recognize patterns in data and speech, translate languages, make financial predictions, and much more through thousands, or sometimes millions, of interconnected processing nodes. Data is “fed-forward” through the layers, performing a weighted combination and additional processing (activation) at each node, before propagating the results forward to the next layer.

Crucially, the gradient descent algorithm is used to learn from input training data in order to reduce the errors (or loss) of the neural network’s predictions. As such, neural networks serve as key examples of the power and potential of machine learning models.

One example of a neural network architecture is the transformer architecture, which is the architecture commonly used to create the large language models (LLMs) that power generative AI applications like ChatGPT.

Deep learning is a subset of machine learning that uses neural networks. A deep learning model is simply a neural network with many layers (more than one hidden layer) between the input and output. This layered structure allows them to automatically learn complex patterns from massive amounts of raw data — and the more data that is received, the more the predictive model potentially can improve.

You might find this approach to machine learning at the heart of services like ChatGPT and voice-driven TV remotes, in fraud detection technology for credit card companies, and as the bedrock of operating systems for self-driving cars.

Real-World Examples of Machine Learning

Companies leveraging algorithms to sort through data and optimize business operations aren’t new. Leveraging algorithms extends not only to digital business models such as web services or apps, but also to any company or industry where data can be gathered, including the following:

  • Marketing and sales: ML can generate predictions for marketing decisions, such as which customers will respond most positively to certain offers.
  • Financial services: In banking, machine learning is used to improve risk management and enhance fraud detection. Algorithms are trained to automatically and immediately identify fraud and stop harmful transactions before they happen.
  • In-person shopping: ML algorithms can deliver precise inventory recommendations based on inputs like historical sales, weather, and holiday patterns at specific locations. This can help manage storage costs while meeting consumer demand.
  • Health care: ML algorithms are improving the accuracy and efficiency of medical image analysis; They help detect tumors during radiological examinations, identify eye disease in retinal images, and more.

Benefits and Risks of Machine Learning

Machine learning is transformational, but should be applied with a balanced perspective. While the benefits in efficiency and insight are powerful, the technology is not neutral. When left unchecked, ML can present significant technical and ethical challenges.

Benefits of Machine LearningRisks of Machine Learning
ML automates time-consuming, repetitive tasks
Algorithmic bias can reinforce stereotypes and harmful outcomes
Models can identify patterns invisible to humans
‘Black box’ nature of models makes transparency difficult
Continuous iteration improves accuracy and efficiency
Models that require access to sensitive data create security vulnerabilities
Scales and handles large datasets easily
Computational costs can be prohibitive
Enables innovation and advanced solution
Poor data quality can lead to inaccurate predictions

Evolution of Machine Learning

Although advances in computing technologies have made machine learning more popular than ever, it’s not a new concept. According to the Lawrence Livermore National Laboratory, the origins of machine learning date back to 1950. Speculating on how one could tell if they had developed a truly integrated artificial intelligence (AI), Alan Turing created what is now referred to as the Turing test, which suggests that one way of testing whether or not the AI is capable of understanding language is to see if it’s able to fool a human into thinking they are speaking to another person.

In the early 1950’s, Arthur Samuel wrote the first learning program for IBM, this time involving a game of checkers. The work of many other machine learning pioneers followed, including Frank Rosenblatt’s design of the first neural network in 1957 and Gerald DeJong’s introduction of explanation-based learning in 1981.

In the 1990s, machine learning shifted away from hand-coded rules toward programs that could learn patterns from data on their own. The datasets were still small by today’s standards, but this decade laid the mathematical groundwork that would later power the field’s explosion.

The 2000s saw kernel methods and ensemble learning dominate, while foundational work on neural network training set the stage for the deep learning revolution of the 2010s.

Milestones in machine learning are marked by instances in which an algorithm is able to beat the performance of a human being, including Russian chess grandmaster Garry Kasparov’s defeat at the hands of IBM supercomputer Deep Blue in 1997 and, more recently, the 2016 victory of the Google DeepMind AI program AlphaGo over Lee Sedol playing Go, a game notorious for its massively large space of possibilities in game play.

Today, researchers are hard at work to expand on these achievements. The last five years have ushered in an accelerated era for machine learning, largely defined by the rise of massive language models, generative AI, and the democratization of these sophisticated tools.

What Is the Future of Machine Learning?

Machine learning algorithms are being used around the world in nearly every major sector, including business, government, finance, agriculture, transportation, cybersecurity, and marketing. Such rapid adoption across disparate industries is evidence of the value that machine learning (and, by extension, data science) creates. Armed with insights from vast datasets — which often occur in real time — organizations can operate more efficiently and gain a competitive edge.

Previous AI systems operated in silos (text- or image-only), but the next generation is characterized by multimodal AI, which processes and correlates multiple data types simultaneously. For example, in health care, multimodal AI can integrate patient history, clinical evidence, and medical images to improve diagnostic accuracy. For commerce, it analyzes customer reviews, product images, and audio calls for richer customer insights.

As ML systems are entrusted with these kinds of high-stakes decisions, the emphasis on explainable AI (XAI) will increase. This movement is aimed at increasing the transparency and interpretability of complex algorithms, with the global XAI market expected to reach $24.58 billion by 2030. As AI becomes more autonomous, understanding how it arrives at a decision is critical for ensuring accountability, reducing bias, and building public trust.

Machine Learning and UC Berkeley School of Information

In recognition of machine learning’s critical role today and in the future, datascience@berkeley includes an in-depth focus on machine learning in its online Master of Information and Data Science (MIDS) curriculum.

The foundation course is Applied Machine Learning, which provides a broad introduction to the key ideas in machine learning. The emphasis is on intuition and practical examples rather than theoretical results, though some experience with probability, statistics, and linear algebra is important. Students learn how to apply powerful machine learning techniques to new problems, run evaluations and interpret results, and think about scaling up from thousands of data points to billions.

The advanced course, Machine Learning at Scale, builds on and goes beyond the collect-and-analyze phase of big data by focusing on how machine learning algorithms can be rewritten and extended to scale to work on petabytes of data, both structured and unstructured, to generate sophisticated models used for real-time predictions.

In the Natural Language Processing with Deep Learning course, students learn how to use modern deep learning techniques to train text-understanding algorithm

Learn more about the datascience@berkeley curriculum or explore the online Machine Learning short course from the UC Berkeley School of Information, which requires no programming or coding experience, and prepares working professionals to implement machine learning in their organization.

  • Machine learning is heavily reliant on coding, particularly focused on data manipulation and algorithm implementation. Machine learning engineers often use languages like Python and libraries such as NumPy and pandas to clean and prepare datasets. Python is also a popular language for building, training, and evaluating machine learning models.

  • ChatGPT is an example of an artificial intelligence application that is powered by machine learning. AI is the overarching goal: simulating human intelligence and decision-making computationally. Machine learning is the core technology used to solve the problem via a large language model (LLM).

  • Machine learning skills are useful for many tech-focused roles across a variety of industries. Some examples include data scientists, machine learning engineers, and software developers.

  • The machine learning lifecycle is a continuous feedback loop centered around model improvement over time. There are a few key stages, including data collection and preparation, model design and training, evaluation and model deployment.

  • ML and data science overlap heavily, but they are different disciplines. Data science is a multidisciplinary field focused on using statistical and computational methods to extract insights from data. Machine learning is a tool in the data science toolkit; It can be used to design and apply algorithms that help discover these insights and apply them to real-world problems.

Citation for this content: datascience@berkeley, the online Master of Information and Data Science from UC Berkeley.

Last updated March 2026.