HƯỚNG DẪN cơ bản

Hàm mất mát

A loss defines the objective used to assess predictions or another training target.

Nghe hướng dẫn nàyAI thuật lại · ~3 min

Trên trang nàyĐọc trong 3 phút
  1. Tổng quan
  2. Lặn sâu
  3. Triển khai trong thế giới thực
  4. Tương lai của hàm mất mát
  5. Đưa nó vào thực tế
  6. Tiếp tục khám phá
  7. Câu hỏi thường gặp

Tổng quan

Individual loss values are often combined into a scalar for optimization, and the chosen objective is a proxy that may differ from the application's evaluation metric.

Lặn sâu

A prediction loss compares outputs with training targets according to a specified rule. Those targets can be labels or values constructed for the learning task; they should not automatically be called unquestionable truth. Implementations may produce per-example losses and then sum or average them for an optimization step. Choosing the rule matters. Mean squared error averages squared residuals, giving large residuals more influence than mean absolute error, which averages their absolute values. For residuals one and three, mean squared error is five, while mean absolute error is two. These are illustrative calculations rather than performance results from a dataset. Classification commonly uses cross-entropy. With a one-hot target and a predicted probability p for its class, the loss is minus log p. A lower probability for the target class gives a larger loss, so confident wrong predictions can incur high loss. The logarithm base determines the units: base-two loss is in bits, while a natural logarithm gives nats. For a target probability of one-quarter, minus log-base-two p is two bits. Gradient-based optimization needs usable derivative information, but differentiability requirements should not be generalized to every learning algorithm. Some losses have nondifferentiable points handled by an appropriate subgradient or surrogate. Accuracy is a discrete evaluation metric and is generally not directly useful as a gradient-training objective. A suitable training loss supplies an optimization signal; final task quality needs evaluation using the relevant metrics.

Triển khai trong thế giới thực

Sử dụng tính năng mất entropy chéo để đào tạo trình phân loại thư rác qua email nhằm xử phạt các hành vi phân loại sai lầm đáng tin cậy

Chọn sai số trung bình tuyệt đối để dự đoán giá nhà nên một số biệt thự cực đoan không lấn át đào tạo

Áp dụng sự mất mát tương phản để mô hình nhận dạng khuôn mặt tập hợp các hình ảnh của cùng một người

Thiết kế mô hình phần thưởng để điều khiển chatbot hướng tới những phản hồi hữu ích và trung thực hơn

Tương lai của hàm mất mát

Objective design can combine prediction terms, regularization, and other task requirements. Comparisons should state the target definition, formula, reduction, units, and evaluation metric. An objective can decrease while an application metric remains unchanged or worsens, so improvement should be measured rather than inferred from training loss alone. Custom losses need examination of the behavior they encourage as well as their numerical and optimization properties.

Đưa nó vào thực tế

Tại sao nó quan trọng

  • Quyết định rõ ràng hơn. Nó giúp bạn tách biệt các tuyên bố kỹ thuật rõ ràng khỏi ngôn ngữ tiếp thị.
  • Chi phí và ngân sách. Bạn có thể đặt các câu hỏi triển khai tốt hơn trước khi chi tiền hoặc thời gian.
  • Nhóm và quy trình làm việc. Các nhóm có sự hiểu biết chung sẽ đưa ra các quyết định về sản phẩm, chính sách và học tập tốt hơn.

coi chừng

  • Các nhóm khác nhau có thể sử dụng cùng một thuật ngữ một cách khác nhau, vì vậy hãy sớm xác định phạm vi.
  • Điểm chuẩn có thể trông mạnh mẽ trong khi hiệu suất trong thế giới thực không đồng đều.
  • Việc bỏ qua các kế hoạch đánh giá và chất lượng dữ liệu thường tạo ra những kết quả mong manh.

Các bước tiếp theo

  1. Bắt đầu với một định nghĩa đơn giản về kết quả bạn cần.
  2. Chọn một số liệu thành công và một điều kiện thất bại trước khi thử nghiệm.
  3. Chạy một thử nghiệm nhỏ với dữ liệu đại diện chứ không phải một bản demo bóng bẩy.
  4. Tài liệu nơi Hàm mất mát hữu ích và nơi các phương pháp đơn giản hơn sẽ tốt hơn.

Tiếp tục khám phá

Bản tin miễn phí

Nhận bản tóm tắt AI hàng ngày

Ba câu chuyện AI đã được xác minh vào mỗi buổi sáng các ngày trong tuần, được viết bằng tiếng Anh đơn giản. Miễn phí mãi mãi, không có quảng cáo.

Một email mỗi ngày trong tuần. Hủy đăng ký trong một cú nhấp chuột. Chúng tôi không bao giờ bán hoặc chia sẻ địa chỉ của bạn.

Tự kiểm tra

Take the Loss Functions quiz

Phản hồi tức thì về mọi câu trả lời và chứng chỉ có thể chia sẻ với ID có thể xác minh sau khi bạn vượt qua khóa học.

Bắt đầu bài kiểm tra

Hỗ trợ giáo dục AI miễn phí. AI Understanding là tổ chức phi lợi nhuận 501(c)(3) — không bao giờ có quảng cáo, không có tường phí. Hãy quyên góp

Câu hỏi thường gặp

Hàm mất mát là gì?

A loss defines the objective used to assess predictions or another training target. Individual loss values are often combined into a scalar for optimization, and the chosen objective is a proxy that may differ from the application's evaluation metric.

For a prediction task, what does its selected loss quantify against the training target?

A loss defines a training objective; it does not automatically measure every aspect of application quality.

Hàm mất mát nào được sử dụng phổ biến nhất cho các nhiệm vụ phân loại?

Entropy chéo so sánh phân phối xác suất dự đoán với nhãn thực và là lựa chọn tiêu chuẩn để phân loại.

So với sai số bình phương trung bình, tại sao bạn có thể chọn sai số tuyệt đối trung bình?

Sai số tuyệt đối trung bình xử lý tất cả các sai số theo tỷ lệ thay vì bình phương chúng, do đó một số sai số cực đoan có ít ảnh hưởng hơn.

Why does gradient-based training need a usable loss derivative or suitable substitute?

This concerns gradient-based training, not a claim that every possible learning algorithm requires a differentiable loss.

How does one-hot class cross-entropy change as probability assigned to the target class becomes very small?

The term minus log p grows as the target-class probability shrinks. This does not guarantee a particular gradient magnitude for every model weight.