Yolo Tầm nhìn Thâm Quyến
Thâm Quyến
Tham gia ngay
Bảng chú giải thuật ngữ

Hồi quy tuyến tính (Linear Regression)

Khám phá sức mạnh của Hồi quy tuyến tính trong học máy! Tìm hiểu các ứng dụng, lợi ích và khái niệm chính của nó để đạt được thành công trong mô hình hóa dự đoán.

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.

Core 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.

Ứng dụng thực tế trong 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.

Linear 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.

Example: 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.

Tham gia Ultralytics cộng đồng

Tham gia vào tương lai của AI. Kết nối, hợp tác và phát triển cùng với những nhà đổi mới toàn cầu

Tham gia ngay