Meet YOLO26: next-gen vision AI.
Ultralytics
Back to Ultralytics Glossary

Linear Regression

Explore linear regression fundamentals and its role in AI. Learn how Ultralytics YOLO26 uses regression for precise object detection and bounding box coordinates.

Linear Regression is a fundamental statistical method and a foundational algorithm in supervised learning used to model the relationship between a dependent variable (target) and one or more independent variables (features). Unlike classification algorithms that predict discrete categories, linear regression predicts a continuous output, making it essential for tasks where the goal is to forecast specific numerical values. Its simplicity and interpretability serve as a gateway to understanding more complex machine learning (ML) concepts, as it introduces the core mechanics of how models learn from data by minimizing error.

Link to this sectionCore Mechanics and Training#

The primary objective of this technique is to find the "line of best fit"—or a hyperplane in higher dimensions—that best describes the data pattern. To achieve this, the algorithm calculates a weighted sum of the input features plus a bias term. During the training process, the model iteratively adjusts these internal parameters, known as weights and biases, to reduce the discrepancy between its predictions and the actual ground truth.

This discrepancy is quantified using a loss function, with the most common choice being Mean Squared Error (MSE). To effectively minimize the loss, an optimization algorithm such as gradient descent is employed to update the weights. If the model aligns too closely with the noise in the training data, it risks overfitting, whereas a model that is too simple to capture the underlying trend suffers from underfitting.

Link to this sectionReal-World Applications in AI#

While often associated with simple predictive modeling in data analytics, linear regression principles are deeply embedded in advanced deep learning (DL) architectures.

  • Financial Forecasting: Analysts use regression to predict housing prices, stock values, or sales revenue based on historical data points like square footage, location, or previous market trends.
  • Computer Vision and Object Detection: Modern object detectors, such as the YOLO26 family of models, utilize regression in their detection heads. Specifically, the model performs "bounding box regression" to predict the precise continuous coordinates (center x, center y, width, height) of an object within an image.

Link to this sectionLinear Regression vs. Logistic Regression#

It is important to distinguish this term from Logistic Regression. Although both are linear models, their outputs differ significantly. Linear regression predicts a continuous numeric value (e.g., the price of a car). In contrast, logistic regression is used for classification tasks, predicting the probability that an input belongs to a specific category (e.g., whether an email is "spam" or "not spam") by passing the linear output through an activation function like the sigmoid function.

Link to this sectionExample: Regression in Object Detection#

In the context of computer vision, when a model like YOLO26 detects an object, the bounding box coordinates are the result of a regression task. The model predicts continuous values to locate the object precisely.

from ultralytics import YOLO

# Load the YOLO26 model (nano version)
model = YOLO("yolo26n.pt")

# Run inference on an image
# The model uses regression to determine the exact box placement
results = model("https://ultralytics.com/images/bus.jpg")

# Display the continuous regression outputs (x, y, width, height)
for box in results[0].boxes:
    print(f"Box Regression Output (xywh): {box.xywh.numpy()}")

Users looking to train custom models that leverage these regression capabilities for specialized datasets can utilize the Ultralytics Platform for streamlined annotation and cloud training. Understanding these basic regression principles provides a solid foundation for mastering complex tasks in artificial intelligence (AI) and computer vision.

Explore solutions

Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more
Real-time AI that works with your team

AI in Robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.

Learn more
Real-time AI that works with your team

AI in Logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.

Learn more
Real-time AI that works with your team

AI in Retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.

Learn more
Real-time AI that works with your team

AI in Healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.

Learn more
Real-time AI that works with your team

AI in Manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.

Learn more
Real-time AI that works with your operation

AI in Automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.

Learn more
Real-time AI tailored to your operation

AI in Agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.

Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning