Machine Learning (ML)
Machine learning (ML) is the branch of AI in which systems learn patterns from data instead of hand-coded rules. How it works, its main types, and uses.
Machine learning (ML) is the branch of artificial intelligence (AI) in which computer systems learn patterns from data instead of following rules written by a programmer. A spam filter built with ML is never told which words signal spam; it studies thousands of emails labeled spam or not spam and learns the patterns itself, then applies them to new messages. Arthur Samuel coined the term in 1959 while building a checkers program that improved by playing against itself, and Tom Mitchell later gave a widely cited definition: a program learns when its performance at a task, measured by some metric, improves with experience.
How Machine Learning Works#
An ML model is a function with adjustable parameters, from the few coefficients of a linear regression to the millions of weights in a neural network. Training searches for the parameter values that make the model's predictions on the training data as accurate as possible, usually by minimizing a loss function. The real test is generalization: the model is then scored on held-out validation data and test data it never saw during training. A model that scores well on training data but poorly on new data is overfitting, memorizing examples instead of learning the underlying pattern.
This scikit-learn example trains a random forest to read handwritten digits and scores it on digits held out from training:
from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
# 1,797 labeled 8x8 images of handwritten digits bundled with scikit-learn
X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0)
# Fit learns decision rules from the labeled examples; no rules are hand-written
model = RandomForestClassifier(random_state=0)
model.fit(X_train, y_train)
# Score on digits the model never saw during training
print(f"Test accuracy: {model.score(X_test, y_test):.1%}")The model reaches 97.6% accuracy on the 450 test digits, using only patterns it learned from the other 1,347 labeled examples.
Types of Machine Learning#
- Supervised learning: learns from labeled examples, each input paired with the correct output. Classification, regression, and object detection are supervised tasks.
- Unsupervised learning: finds structure in unlabeled data, such as customer segments found by k-means clustering.
- Self-supervised learning: creates its own labels from the data, for example by predicting the next word in a sentence or a hidden patch of an image. It is how large language models (LLMs) and other foundation models are pretrained.
- Reinforcement learning: an agent learns by trial and error, taking actions in an environment and adjusting its behavior to maximize a reward.
Machine Learning vs. AI, Deep Learning, and Data Science#
Machine learning sits between AI, the broad goal of building intelligent machines, and deep learning (DL), the subset of ML that uses many-layered neural networks and learns its own features from raw data:
Classical algorithms such as random forests and XGBoost remain strong on tabular data, where each column, such as price or age, is already a meaningful feature. Data science is a neighboring discipline that uses ML as one tool among many, alongside statistics, data visualization, and domain analysis, to answer questions from data.
The Machine Learning Lifecycle#
A model in production is never finished. Teams collect and label data, train and validate a model, deploy it, and monitor its predictions, returning to the data whenever accuracy falls short or the real world changes. This loop is the subject of machine learning operations (MLOps):
For computer vision, Ultralytics Platform runs this whole loop in one place: teams upload and annotate datasets, train Ultralytics YOLO26 models on cloud GPUs, deploy them, and monitor their performance in production.
Real-World Applications#
- Computer vision: models detect defects on production lines, read medical scans, and guide autonomous vehicles.
- Natural language processing (NLP): translation, search, chatbots, and spam filtering all rely on models trained on text.
- Recommendation systems: streaming and e-commerce platforms rank content for each user from their past behavior.
- Time series forecasting: models predict product demand, energy load, and equipment failures from historical data.
- Anomaly detection: banks score every card transaction in milliseconds with models trained on past fraud, flagging the ones that look unusual.










