分类问题的损失函数
对于回归问题,可以使用均方差作为损失函数,对于分类问题,如何度量预测值与真实值之间的差异?...],
[5, 2], [3, 5], [4, 7], [4, -1]])
y = np.array([0, 1, 1, 0, 0, 1, 1, 0])
# 创建逻辑分类器对象...x[:, 0].min() - 1
right = x[:, 0].max() + 1
buttom = x[:, 1].min() - 1
top = x[:, 1].max() + 1
# 产生网格化矩阵...利用逻辑分类器实现多元分类示例代码如下:
# 多元分类器示例
import numpy as np
import sklearn.linear_model as lm
import matplotlib.pyplot...5.7, 1.5],
[5.4, 2.2]])
# 输出(多个类别)
y = np.array([0, 0, 0, 1, 1, 1, 2, 2, 2])
# 创建逻辑分类器对象