【从零开始的机器学习之旅】02-Deeplearning-general_guidance

Nannan Lv5

-Deeplearning-general_guidance

1.Ups and downs of Deep Learning

image-20240625194554101

2. Three Step for Deep Learning

image-20240625194720032

Step1:Neural Network

Neural Network: 点击查看更多
image-20240625195101817

Network parameter :all the weights and biases in the “neurons”

那么多的neuron我们应该怎么把它接起来呢?

有很多种方法。究竟怎么连接其实是你手动设定的。

Fully Connect Feedforward Network

image-20240625195606351

箭头上的表示weight,红色的数字代表bias。我们让再代入函数得到一个值。

假设这个structural里面的所有的neuron它的weight和bias我们都是知道的,我们就可以反复进行上面的运算。

image-20240625195948770

当我们输入1和-1之后呢,我们得到0.62和0.83。

尝试改变我们的输入:

image-20240625200212946

输入0和0之后呢,我们会得到0.51和0.85。

那么对于一个neural network,我们可以把它看作一个function。

那么如果今天我不知道每一个neuron的weight和bias的话,但是有了连接的方法,其实就相当于我们是定义了一个function set

image-20240625200327348

In general:

image-20240625200744442

Deep = Many hidden layers

image-20240625201038262

Network 如何运作呢?

我们通常会用Matrix Operation的方式进行。

image-20240625201519651

In general:

image-20240625201708233

![image-20240625201743975](C:\Users\Zhou Yanan\AppData\Roaming\Typora\typora-user-images\image-20240625201743975.png)

写成矩阵形式的好处是什么呢?你可以用GPU加速

关于Output Layer

image-20240625202146920 image-20240625202220143

Example Application

image-20240625202315068

输入是256个维度的特征,输出是代表是某一个数字的概率。

image-20240625202434611 image-20240625202555394

那么Neural Network要如何设计呢?比如以手写数字判断的例子为例。如果当前这个Neural固定是输入256维,输出是10维的,那么它就可以用了做预测手写数字的Network。

image-20240625202821759

也就是说,目前的限制只有输入和输出的维度,而我们中间的维度是没有限制的,层数也是没有限制的。我们需要自己去设计它,我们需要去决定function set长什么样子

Q&A

image-20240625203955176

Step2:goodness of function

image-20240625204444485 image-20240625204515731

step3:pick the best function

那么我们如何去找这个minimizes total loss L呢?

—— Gradient Descent

image-20240625204731119 image-20240625204744456 image-20240625204832349

关于如何计算这个微分?

Backpropagation(反向传播)

  • Backpropagation: an efficient way to compute in neural network.
image-20240625205142933
Backpropagation: 点击查看更多

为什么需要Backpropagation?

image-20240625210344814

参数量实在是太多啦。

——To compute the gradients efficiently,we use backpropagation.

前置知识:Chain Rule(链式法则)

image-20240625211100165image-20240625211328066

我们先考虑简单的,三角形区域的一个neuron。

我们以这个参数为例:

image-20240625211626364image-20240625211713191

我们发现一个规律就是我们要求对谁的偏导,其实看它前面的系数就好了,也就是这个partial的input。

image-20240625212017548

Forward pass

image-20240625212105186

Backward pass

image-20240625212319799image-20240625212540739

我们先假设我们知道的值,我们会怎么去写?

image-20240625212753467

我们换一个角度去看这件事情:

image-20240625212912581

z是在算forward pass的时候就已经被决定好了的,它是一个常数。

那么最后的问题就是怎么算这两项。

考虑两个情况:

Case1:Output Layer

image-20240625213457647

Case2:Not Output Layer

image-20240625213746497

In general:

image-20240625213947315

即:

image-20240625214046100

就好像我们建了一个反向的neural network

Summary

image-20240625214237236

3. Deeper is Better?

image-20240625205300372

让我们来看一个有趣的理论

image-20240625205421121

这个理论就是说,任意连续的function,假设输入是N维,输出是M维,它都可以用一个hidden layer来表示(只有足够多)。

那么问题就来了,既然一个hidden layer就可以表示成任何函数,那么我们为什么还要做Deep呢?

Why “Deep” neural network not “Fat” neural network?

在后续的学习中会解答这个问题…

  • Title: 【从零开始的机器学习之旅】02-Deeplearning-general_guidance
  • Author: Nannan
  • Created at : 2024-06-25 21:55:12
  • Updated at : 2024-09-29 23:20:52
  • Link: https://redefine.ohevan.com/2024/06/25/02-Deeplearning-general_guidance/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments