Softmax 回归
回归 VS 分类
- 回归估计一个连续值
- 分类预测一个离散类别

从回归到多类分类

均方损失

“一位有效编码”通常是指 独热编码(One-Hot Encoding)。这是机器学习和数字电路中常用的一种将离散类别变量转换为数值向量的方法。
import torch
import torch.nn.functional as F
# 假设类别标签(0=红, 1=绿, 2=蓝)
labels = torch.tensor([0, 1, 2])
# 转为 one-hot(一位有效编码)
one_hot = F.one_hot(labels, num_classes=3)
print(one_hot)
# 输出:
# tensor([[1, 0, 0],
# [0, 1, 0],
# [0, 0, 1]])
softmax

- Softmax可归是一个多类分类模型
- 使用Softmax操作子得到每个类的预测置信度
- 使用用交又来来衡量颁测和标号的区另别!
