5.1 非线性边界

5.2 误差函数

刚刚的感知器算法实现告诉我们,获取正确分类的方式,就是通过每一个错误分类的点,评估错误点位置与我们期望位置之间的差异,来慢慢的修正我们分类函数。

因为误差暗示了如何进行正确的分类,因此误差的定义就变得尤为重要,这也被称为误差函数

5.3 误差函数与梯度下降

5.4 离散型与连续性-为什么使用sigmoid

Discrete: 0或1

Continuous: 类似54.31%,概率

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

5.5 多类别分类和softmax

5.5.1 Softmax

Softmax 公式:

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

5.5.2 Softmax code

```python

import numpy as np

#1

def softmax(L):

    expL = np.exp(L)

    sumExpL = sum(expL)

    result = []

    for i in expL:

        result.append(i*1.0/sumExpL)

    return result

   

#

def softmax(L):

    expL = np.exp(L)

    return np.divide (expL, expL.sum())

```

5.6 最大似然率

统计学中,最大似然估计(英语:maximum likelihood estimation,缩写为MLE),也称极大似然估计最大概似估计,是用来估计一个概率模型的参数的一种方法。

给定一个概率分布D,假定其概率密度函数(连续分布)或概率聚集函数(离散分布)为fD,以及一个分布参数θ,我们可以从这个分布中抽出一个具有n个值的采样X1,X2,...,Xn,通过利用fD,我们就能计算出其概率

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

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

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

source code:

1.

import numpy as np

# Write a function that takes as input two lists Y, P,

# and returns the float corresponding to their cross-entropy.

def cross_entropy(Y, P):

   

    Y = np.float_(Y)

    P = np.float_(P)

   

    #print(P)

    ln_p = np.log(P)

    ln_minP = np.log(1 - P)

   

    Cross_Entropy = 0.0

   

    for i in range(len(Y)):

        Cross_Entropy = Cross_Entropy - (Y[i]*ln_p[i] + (1 - Y[i])*ln_minP[i])   

   

    return Cross_Entropy

2.

import numpy as np

def cross_entropy(Y, P):

    Y = np.float_(Y)

    P = np.float_(P)

    return -np.sum(Y * np.log(P) + (1 - Y) * np.log(1 - P))

5.8 多类别交叉熵

Multi-Class Cross-Entropy

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

 

5.9 Logistic 回归

对数几率回归算法:

  1. 获得数据
  2. 选择一个随机模型
  3. 计算误差
  4. 最小化误差,获得更好的模型
  5. 完成!

5.9.1 计算误差函数

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

multi-Class error function

[学习] 深度学习-Lesson 5 Deep Learning abstract 2

5.9.2 最小化误差函数

相关文章: