深度学习 - RNN训练过程推演

2024-06-17 22:12

本文主要是介绍深度学习 - RNN训练过程推演,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1. 数据准备

字符序列 “hello” 转换为 one-hot 编码表示:

  • 输入: [‘h’, ‘e’, ‘l’, ‘l’]
  • 输出: [‘e’, ‘l’, ‘l’, ‘o’]

2. 初始化参数

我们使用一个单层的 RNN,隐藏层大小为2,每次传1个字符。初始参数如下:

W x h = ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) , W h h = ( 0.1 0.2 0.3 0.4 ) , W h y = ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) W_{xh} = \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \\ 0.5 & 0.6 \\ 0.7 & 0.8 \end{pmatrix}, \quad W_{hh} = \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \end{pmatrix}, \quad W_{hy} = \begin{pmatrix} 0.1 & 0.2 & 0.3 & 0.4 \\ 0.5 & 0.6 & 0.7 & 0.8 \end{pmatrix} Wxh= 0.10.30.50.70.20.40.60.8 ,Whh=(0.10.30.20.4),Why=(0.10.50.20.60.30.70.40.8)

偏置项初始化为0。

3. 前向传播和反向传播

时间步 1(输入 ‘h’):

输入向量 x 1 = [ 1 , 0 , 0 , 0 ] x_1 = [1, 0, 0, 0] x1=[1,0,0,0]

h 1 = tanh ⁡ ( W x h x 1 + W h h h 0 ) = tanh ⁡ ( ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) ( 1 0 0 0 ) + ( 0.1 0.2 0.3 0.4 ) ( 0 0 ) ) = tanh ⁡ ( ( 0.1 0.3 ) ) = ( 0.0997 0.2913 ) h_1 = \tanh(W_{xh} x_1 + W_{hh} h_0) = \tanh \left( \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \\ 0.5 & 0.6 \\ 0.7 & 0.8 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} + \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \end{pmatrix} \begin{pmatrix} 0 \\ 0 \end{pmatrix} \right) = \tanh \left( \begin{pmatrix} 0.1 \\ 0.3 \end{pmatrix} \right) = \begin{pmatrix} 0.0997 \\ 0.2913 \end{pmatrix} h1=tanh(Wxhx1+Whhh0)=tanh 0.10.30.50.70.20.40.60.8 1000 +(0.10.30.20.4)(00) =tanh((0.10.3))=(0.09970.2913)

y 1 = W h y h 1 = ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) ( 0.0997 0.2913 ) = ( 0.1695 0.3889 0.6083 0.8277 ) y_1 = W_{hy} h_1 = \begin{pmatrix} 0.1 & 0.2 & 0.3 & 0.4 \\ 0.5 & 0.6 & 0.7 & 0.8 \end{pmatrix} \begin{pmatrix} 0.0997 \\ 0.2913 \end{pmatrix} = \begin{pmatrix} 0.1695 \\ 0.3889 \\ 0.6083 \\ 0.8277 \end{pmatrix} y1=Whyh1=(0.10.50.20.60.30.70.40.8)(0.09970.2913)= 0.16950.38890.60830.8277

预测值 y ^ 1 = softmax ( y 1 ) \hat{y}_1 = \text{softmax}(y_1) y^1=softmax(y1)

假设真实输出为 ‘e’,对应 one-hot 编码为 y 1 = [ 0 , 1 , 0 , 0 ] y_1 = [0, 1, 0, 0] y1=[0,1,0,0]

交叉熵损失函数:

loss 1 = − ∑ i y 1 i log ⁡ ( y ^ 1 i ) \text{loss}_1 = - \sum_{i} y_{1i} \log(\hat{y}_{1i}) loss1=iy1ilog(y^1i)

梯度计算:

∂ loss 1 ∂ W h y = ( y ^ 1 − y 1 ) h 1 T \frac{\partial \text{loss}_1}{\partial W_{hy}} = (\hat{y}_1 - y_1) h_1^T Whyloss1=(y^1y1)h1T

∂ loss 1 ∂ W x h = ∂ loss 1 ∂ h 1 ⋅ ∂ h 1 ∂ W x h \frac{\partial \text{loss}_1}{\partial W_{xh}} = \frac{\partial \text{loss}_1}{\partial h_1} \cdot \frac{\partial h_1}{\partial W_{xh}} Wxhloss1=h1loss1Wxhh1

∂ loss 1 ∂ W h h = ∂ loss 1 ∂ h 1 ⋅ ∂ h 1 ∂ W h h \frac{\partial \text{loss}_1}{\partial W_{hh}} = \frac{\partial \text{loss}_1}{\partial h_1} \cdot \frac{\partial h_1}{\partial W_{hh}} Whhloss1=h1loss1Whhh1

参数更新:

W x h = W x h − η ∂ loss 1 ∂ W x h W_{xh} = W_{xh} - \eta \frac{\partial \text{loss}_1}{\partial W_{xh}} Wxh=WxhηWxhloss1

W h h = W h h − η ∂ loss 1 ∂ W h h W_{hh} = W_{hh} - \eta \frac{\partial \text{loss}_1}{\partial W_{hh}} Whh=WhhηWhhloss1

W h y = W h y − η ∂ loss 1 ∂ W h y W_{hy} = W_{hy} - \eta \frac{\partial \text{loss}_1}{\partial W_{hy}} Why=WhyηWhyloss1

时间步 2(输入 ‘e’):

使用更新后的 W x h W_{xh} Wxh W h h W_{hh} Whh W h y W_{hy} Why 参数。

输入向量 x 2 = [ 0 , 1 , 0 , 0 ] x_2 = [0, 1, 0, 0] x2=[0,1,0,0]

h 2 = tanh ⁡ ( W x h x 2 + W h h h 1 ) = tanh ⁡ ( ( 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 ) ( 0 1 0 0 ) + ( 0.1 0.2 0.3 0.4 ) ( 0.0997 0.2913 ) ) h_2 = \tanh(W_{xh} x_2 + W_{hh} h_1) = \tanh \left( \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \\ 0.5 & 0.6 \\ 0.7 & 0.8 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} + \begin{pmatrix} 0.1 & 0.2 \\ 0.3 & 0.4 \end{pmatrix} \begin{pmatrix} 0.0997 \\ 0.2913 \end{pmatrix} \right) h2=tanh(Wxhx2+Whhh1)=tanh 0.10.30.50.70.20.40.60.8 0100 +(0.10.30.20.4)(0.09970.2913)

计算后得:

h 2 = tanh ⁡ ( ( 0.3 0.7 ) + ( 0.1283 0.2147 ) ) = tanh ⁡ ( ( 0.4283 0.9147 ) ) h_2 = \tanh \left( \begin{pmatrix} 0.3 \\ 0.7 \end{pmatrix} + \begin{pmatrix} 0.1283 \\ 0.2147 \end{pmatrix} \right) = \tanh \left( \begin{pmatrix} 0.4283 \\ 0.9147 \end{pmatrix} \right) h2=tanh((0.30.7)+(0.12830.2147))=tanh((0.42830.9147))

y 2 = W h y h 2 y_2 = W_{hy} h_2 y2=Whyh2

预测值 y ^ 2 = softmax ( y 2 ) \hat{y}_2 = \text{softmax}(y_2) y^2=softmax(y2)

假设真实输出为 ‘l’,对应 one-hot 编码为 y 2 = [ 0 , 0 , 1 , 0 ] y_2 = [0, 0, 1, 0] y2=[0,0,1,0]

交叉熵损失函数:

loss 2 = − ∑ i y 2 i log ⁡ ( y ^ 2 i ) \text{loss}_2 = - \sum_{i} y_{2i} \log(\hat{y}_{2i}) loss2=iy2ilog(y^2i)

梯度计算:

∂ loss 2 ∂ W h y = ( y ^ 2 − y 2 ) h 2 T \frac{\partial \text{loss}_2}{\partial W_{hy}} = (\hat{y}_2 - y_2) h_2^T Whyloss2=(y^2y2)h2T

∂ loss 2 ∂ W x h = ∂ loss 2 ∂ h 2 ⋅ ∂ h 2 ∂ W x h \frac{\partial \text{loss}_2}{\partial W_{xh}} = \frac{\partial \text{loss}_2}{\partial h_2} \cdot \frac{\partial h_2}{\partial W_{xh}} Wxhloss2=h2loss2Wxhh2

∂ loss 2 ∂ W h h = ∂ loss 2 ∂ h 2 ⋅ ∂ h 2 ∂ W h h \frac{\partial \text{loss}_2}{\partial W_{hh}} = \frac{\partial \text{loss}_2}{\partial h_2} \cdot \frac{\partial h_2}{\partial W_{hh}} Whhloss2=h2loss2Whhh2

参数更新:

W x h = W x h − η ∂ loss 2 ∂ W x h W_{xh} = W_{xh} - \eta \frac{\partial \text{loss}_2}{\partial W_{xh}} Wxh=WxhηWxhloss2

W h h = W h h − η ∂ loss 2 ∂ W h h W_{hh} = W_{hh} - \eta \frac{\partial \text{loss}_2}{\partial W_{hh}} Whh=WhhηWhhloss2

W h y = W h y − η ∂ loss 2 ∂ W h y W_{hy} = W_{hy} - \eta \frac{\partial \text{loss}_2}{\partial W_{hy}} Why=WhyηWhyloss2

时间步 3(输入 ‘l’):

使用更新后的 W x h W_{xh} Wxh W h h W_{hh} Whh W h y W_{hy} Why 参数。

输入向量 x 3 = [ 0 , 0 , 1 , 0 ] x_3 = [0, 0, 1, 0] x3=[0,0,1,0]

h 3 = tanh ⁡ ( W x h x 3 + W h h h 2 ) h_3 = \tanh(W_{xh} x_3 + W_{hh} h_2) h3=tanh(Wxhx3+Whhh2)

计算后得:

h 3 = tanh ⁡ ( ( 0.5 1.2 ) + W h h h 2 ) h_3 = \tanh \left( \begin{pmatrix} 0.5 \\ 1.2 \end{pmatrix} + W_{hh} h_2 \right) h3=tanh((0.51.2)+Whhh2)

y 3 = W h y h 3 y_3 = W_{hy} h_3 y3=Whyh3

预测值 y ^ 3 = softmax ( y 3 ) \hat{y}_3 = \text{softmax}(y_3) y^3=softmax(y3)

假设真实输出为 ‘l’,对应 one-hot 编码为 y 3 = [ 0 , 0 , 1 , 0 ] y_3 = [0, 0, 1, 0] y3=[0,0,1,0]

交叉熵损失函数:

$$
\text{loss}3 = - \sum{i} y_{3i} \log(\hat{y}_{3

i})
$$

梯度计算:

∂ loss 3 ∂ W h y = ( y ^ 3 − y 3 ) h 3 T \frac{\partial \text{loss}_3}{\partial W_{hy}} = (\hat{y}_3 - y_3) h_3^T Whyloss3=(y^3y3)h3T

∂ loss 3 ∂ W x h = ∂ loss 3 ∂ h 3 ⋅ ∂ h 3 ∂ W x h \frac{\partial \text{loss}_3}{\partial W_{xh}} = \frac{\partial \text{loss}_3}{\partial h_3} \cdot \frac{\partial h_3}{\partial W_{xh}} Wxhloss3=h3loss3Wxhh3

∂ loss 3 ∂ W h h = ∂ loss 3 ∂ h 3 ⋅ ∂ h 3 ∂ W h h \frac{\partial \text{loss}_3}{\partial W_{hh}} = \frac{\partial \text{loss}_3}{\partial h_3} \cdot \frac{\partial h_3}{\partial W_{hh}} Whhloss3=h3loss3Whhh3

参数更新:

W x h = W x h − η ∂ loss 3 ∂ W x h W_{xh} = W_{xh} - \eta \frac{\partial \text{loss}_3}{\partial W_{xh}} Wxh=WxhηWxhloss3

W h h = W h h − η ∂ loss 3 ∂ W h h W_{hh} = W_{hh} - \eta \frac{\partial \text{loss}_3}{\partial W_{hh}} Whh=WhhηWhhloss3

W h y = W h y − η ∂ loss 3 ∂ W h y W_{hy} = W_{hy} - \eta \frac{\partial \text{loss}_3}{\partial W_{hy}} Why=WhyηWhyloss3

时间步 4(输入 ‘l’):

使用更新后的 W x h W_{xh} Wxh W h h W_{hh} Whh W h y W_{hy} Why 参数。

输入向量 x 4 = [ 0 , 0 , 1 , 0 ] x_4 = [0, 0, 1, 0] x4=[0,0,1,0]

h 4 = tanh ⁡ ( W x h x 4 + W h h h 3 ) h_4 = \tanh(W_{xh} x_4 + W_{hh} h_3) h4=tanh(Wxhx4+Whhh3)

计算后得:

h 4 = tanh ⁡ ( ( 0.5 1.2 ) + W h h h 3 ) h_4 = \tanh \left( \begin{pmatrix} 0.5 \\ 1.2 \end{pmatrix} + W_{hh} h_3 \right) h4=tanh((0.51.2)+Whhh3)

y 4 = W h y h 4 y_4 = W_{hy} h_4 y4=Whyh4

预测值 y ^ 4 = softmax ( y 4 ) \hat{y}_4 = \text{softmax}(y_4) y^4=softmax(y4)

假设真实输出为 ‘o’,对应 one-hot 编码为 y 4 = [ 0 , 0 , 0 , 1 ] y_4 = [0, 0, 0, 1] y4=[0,0,0,1]

交叉熵损失函数:

loss 4 = − ∑ i y 4 i log ⁡ ( y ^ 4 i ) \text{loss}_4 = - \sum_{i} y_{4i} \log(\hat{y}_{4i}) loss4=iy4ilog(y^4i)

梯度计算:

∂ loss 4 ∂ W h y = ( y ^ 4 − y 4 ) h 4 T \frac{\partial \text{loss}_4}{\partial W_{hy}} = (\hat{y}_4 - y_4) h_4^T Whyloss4=(y^4y4)h4T

∂ loss 4 ∂ W x h = ∂ loss 4 ∂ h 4 ⋅ ∂ h 4 ∂ W x h \frac{\partial \text{loss}_4}{\partial W_{xh}} = \frac{\partial \text{loss}_4}{\partial h_4} \cdot \frac{\partial h_4}{\partial W_{xh}} Wxhloss4=h4loss4Wxhh4

∂ loss 4 ∂ W h h = ∂ loss 4 ∂ h 4 ⋅ ∂ h 4 ∂ W h h \frac{\partial \text{loss}_4}{\partial W_{hh}} = \frac{\partial \text{loss}_4}{\partial h_4} \cdot \frac{\partial h_4}{\partial W_{hh}} Whhloss4=h4loss4Whhh4

参数更新:

W x h = W x h − η ∂ loss 4 ∂ W x h W_{xh} = W_{xh} - \eta \frac{\partial \text{loss}_4}{\partial W_{xh}} Wxh=WxhηWxhloss4

W h h = W h h − η ∂ loss 4 ∂ W h h W_{hh} = W_{hh} - \eta \frac{\partial \text{loss}_4}{\partial W_{hh}} Whh=WhhηWhhloss4

W h y = W h y − η ∂ loss 4 ∂ W h y W_{hy} = W_{hy} - \eta \frac{\partial \text{loss}_4}{\partial W_{hy}} Why=WhyηWhyloss4

4.代码实现

下面是一个使用 PyTorch 实现简单 RNN(循环神经网络)的示例代码,该代码将字符序列作为输入并预测下一个字符。我们将使用一个小的字符集进行演示。

安装 PyTorch

在开始之前,请确保您已安装 PyTorch。您可以使用以下命令进行安装:

pip install torch
RNN 实现示例

我们将实现一个字符级 RNN,用于从序列 “hello” 中预测下一个字符。字符集为 {‘h’, ‘e’, ‘l’, ‘o’}。

import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np# 定义字符集和字符到索引的映射
chars = ['h', 'e', 'l', 'o']
char_to_idx = {ch: idx for idx, ch in enumerate(chars)}
idx_to_char = {idx: ch for idx, ch in enumerate(chars)}# 超参数
input_size = len(chars)
hidden_size = 10
output_size = len(chars)
num_layers = 1
learning_rate = 0.01
num_epochs = 100# 准备数据
def char_to_tensor(char):tensor = torch.zeros(input_size)tensor[char_to_idx[char]] = 1.0return tensordef string_to_tensor(string):tensor = torch.zeros(len(string), input_size)for idx, char in enumerate(string):tensor[idx][char_to_idx[char]] = 1.0return tensorinput_seq = "hell"
target_seq = "ello"input_tensor = string_to_tensor(input_seq)
target_tensor = torch.tensor([char_to_idx[ch] for ch in target_seq])# 定义 RNN 模型
class RNN(nn.Module):def __init__(self, input_size, hidden_size, output_size):super(RNN, self).__init__()self.hidden_size = hidden_sizeself.rnn = nn.RNN(input_size, hidden_size, num_layers, batch_first=True)self.fc = nn.Linear(hidden_size, output_size)def forward(self, x, hidden):out, hidden = self.rnn(x, hidden)out = self.fc(out[:, -1, :])return out, hiddendef init_hidden(self):return torch.zeros(num_layers, 1, hidden_size)# 初始化模型、损失函数和优化器
model = RNN(input_size, hidden_size, output_size)
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=learning_rate)# 训练模型
for epoch in range(num_epochs):hidden = model.init_hidden()model.zero_grad()input_seq = input_tensor.unsqueeze(0)output, hidden = model(input_seq, hidden)loss = criterion(output, target_tensor.unsqueeze(0))loss.backward()optimizer.step()if (epoch + 1) % 10 == 0:print(f'Epoch [{epoch + 1}/{num_epochs}], Loss: {loss.item():.4f}')# 测试模型
def predict(model, char, hidden=None):if hidden is None:hidden = model.init_hidden()input_tensor = char_to_tensor(char).unsqueeze(0).unsqueeze(0)output, hidden = model(input_tensor, hidden)_, predicted_idx = torch.max(output, 1)return idx_to_char[predicted_idx.item()], hiddenhidden = model.init_hidden()
input_char = 'h'
predicted_seq = input_char
for _ in range(len(input_seq)):next_char, hidden = predict(model, input_char, hidden)predicted_seq += next_charinput_char = next_charprint(f'Predicted sequence: {predicted_seq}')
代码说明
  1. 数据准备

    • 我们定义了一个简单的字符集 {‘h’, ‘e’, ‘l’, ‘o’},并创建了字符到索引和索引到字符的映射。
    • char_to_tensor 函数将字符转换为 one-hot 向量。
    • string_to_tensor 函数将字符串转换为一系列 one-hot 向量。
  2. 定义 RNN 模型

    • RNN 类继承自 nn.Module,包含一个 RNN 层和一个全连接层。
    • forward 方法执行前向传播。
    • init_hidden 方法初始化隐藏状态。
  3. 训练模型

    • 我们使用交叉熵损失函数和 Adam 优化器。
    • 在每个训练周期,我们进行前向传播、计算损失、反向传播和参数更新。
  4. 测试模型

    • predict 函数根据给定的输入字符生成下一个字符。
    • 我们使用训练好的模型从字符 ‘h’ 开始生成一个字符序列。

运行该代码后,您将看到模型预测的字符序列,它会逐渐学会从输入序列中预测下一个字符。

这篇关于深度学习 - RNN训练过程推演的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1070595

相关文章

51单片机学习记录———定时器

文章目录 前言一、定时器介绍二、STC89C52定时器资源三、定时器框图四、定时器模式五、定时器相关寄存器六、定时器练习 前言 一个学习嵌入式的小白~ 有问题评论区或私信指出~ 提示:以下是本篇文章正文内容,下面案例可供参考 一、定时器介绍 定时器介绍:51单片机的定时器属于单片机的内部资源,其电路的连接和运转均在单片机内部完成。 定时器作用: 1.用于计数系统,可

问题:第一次世界大战的起止时间是 #其他#学习方法#微信

问题:第一次世界大战的起止时间是 A.1913 ~1918 年 B.1913 ~1918 年 C.1914 ~1918 年 D.1914 ~1919 年 参考答案如图所示

[word] word设置上标快捷键 #学习方法#其他#媒体

word设置上标快捷键 办公中,少不了使用word,这个是大家必备的软件,今天给大家分享word设置上标快捷键,希望在办公中能帮到您! 1、添加上标 在录入一些公式,或者是化学产品时,需要添加上标内容,按下快捷键Ctrl+shift++就能将需要的内容设置为上标符号。 word设置上标快捷键的方法就是以上内容了,需要的小伙伴都可以试一试呢!

AssetBundle学习笔记

AssetBundle是unity自定义的资源格式,通过调用引擎的资源打包接口对资源进行打包成.assetbundle格式的资源包。本文介绍了AssetBundle的生成,使用,加载,卸载以及Unity资源更新的一个基本步骤。 目录 1.定义: 2.AssetBundle的生成: 1)设置AssetBundle包的属性——通过编辑器界面 补充:分组策略 2)调用引擎接口API

Javascript高级程序设计(第四版)--学习记录之变量、内存

原始值与引用值 原始值:简单的数据即基础数据类型,按值访问。 引用值:由多个值构成的对象即复杂数据类型,按引用访问。 动态属性 对于引用值而言,可以随时添加、修改和删除其属性和方法。 let person = new Object();person.name = 'Jason';person.age = 42;console.log(person.name,person.age);//'J

大学湖北中医药大学法医学试题及答案,分享几个实用搜题和学习工具 #微信#学习方法#职场发展

今天分享拥有拍照搜题、文字搜题、语音搜题、多重搜题等搜题模式,可以快速查找问题解析,加深对题目答案的理解。 1.快练题 这是一个网站 找题的网站海量题库,在线搜题,快速刷题~为您提供百万优质题库,直接搜索题库名称,支持多种刷题模式:顺序练习、语音听题、本地搜题、顺序阅读、模拟考试、组卷考试、赶快下载吧! 2.彩虹搜题 这是个老公众号了 支持手写输入,截图搜题,详细步骤,解题必备

C/C++的编译和链接过程

目录 从源文件生成可执行文件(书中第2章) 1.Preprocessing预处理——预处理器cpp 2.Compilation编译——编译器cll ps:vs中优化选项设置 3.Assembly汇编——汇编器as ps:vs中汇编输出文件设置 4.Linking链接——链接器ld 符号 模块,库 链接过程——链接器 链接过程 1.简单链接的例子 2.链接过程 3.地址和

《offer来了》第二章学习笔记

1.集合 Java四种集合:List、Queue、Set和Map 1.1.List:可重复 有序的Collection ArrayList: 基于数组实现,增删慢,查询快,线程不安全 Vector: 基于数组实现,增删慢,查询快,线程安全 LinkedList: 基于双向链实现,增删快,查询慢,线程不安全 1.2.Queue:队列 ArrayBlockingQueue:

硬件基础知识——自学习梳理

计算机存储分为闪存和永久性存储。 硬盘(永久存储)主要分为机械磁盘和固态硬盘。 机械磁盘主要靠磁颗粒的正负极方向来存储0或1,且机械磁盘没有使用寿命。 固态硬盘就有使用寿命了,大概支持30w次的读写操作。 闪存使用的是电容进行存储,断电数据就没了。 器件之间传输bit数据在总线上是一个一个传输的,因为通过电压传输(电流不稳定),但是电压属于电势能,所以可以叠加互相干扰,这也就是硬盘,U盘

人工智能机器学习算法总结神经网络算法(前向及反向传播)

1.定义,意义和优缺点 定义: 神经网络算法是一种模仿人类大脑神经元之间连接方式的机器学习算法。通过多层神经元的组合和激活函数的非线性转换,神经网络能够学习数据的特征和模式,实现对复杂数据的建模和预测。(我们可以借助人类的神经元模型来更好的帮助我们理解该算法的本质,不过这里需要说明的是,虽然名字是神经网络,并且结构等等也是借鉴了神经网络,但其原型以及算法本质上还和生物层面的神经网络运行原理存在