5.1 非线性边界
5.2 误差函数
刚刚的感知器算法实现告诉我们,获取正确分类的方式,就是通过每一个错误分类的点,评估错误点位置与我们期望位置之间的差异,来慢慢的修正我们分类函数。
因为误差暗示了如何进行正确的分类,因此误差的定义就变得尤为重要,这也被称为误差函数。
5.3 误差函数与梯度下降
5.4 离散型与连续性-为什么使用sigmoid
5.5 多类别分类和softmax
5.5.1 Softmax
5.5.2 Softmax code
```python
return np.divide (expL, expL.sum())
```
5.6 最大似然率
在统计学中,最大似然估计(英语:maximum likelihood estimation,缩写为MLE),也称极大似然估计、最大概似估计,是用来估计一个概率模型的参数的一种方法。
给定一个概率分布D,假定其概率密度函数(连续分布)或概率聚集函数(离散分布)为fD,以及一个分布参数θ,我们可以从这个分布中抽出一个具有n个值的采样X1,X2,...,Xn,通过利用fD,我们就能计算出其概率
5.7 交叉商
Cross-entropy can be used as an error measure when a network's outputs can be thought of as representing independent hypotheses.
In classification problems we want to estimate the probability of different outcomes. If the estimated probability of outcome is, while the frequency (empirical probability) of outcome in the training set is , and there are N samples in the training set, then the likelihood of the training set is
# Write a function that takes as input two lists Y, P,
# and returns the float corresponding to their cross-entropy.
Cross_Entropy = Cross_Entropy - (Y[i]*ln_p[i] + (1 - Y[i])*ln_minP[i])
return -np.sum(Y * np.log(P) + (1 - Y) * np.log(1 - P))