摘要: # 测试 从图中我们可以发现,随着训练次数的增加,Loss越来越小,准确率也是越来越高·。但是在到达某个节点后,随着训练次数的增多Loss反而不稳定起来,准确率也发生波动。所以说明模型的训练并不是次数越多越好。这是因为对于同一个训练集,不断地训练会让模型记住这些样本的一些表面属性,使其在新的数据集上 阅读全文
posted @ 2023-05-31 21:32 同淋雪 阅读(75) 评论(0) 推荐(0)
摘要: # Pytorch高级api搭建多层感知机实战 代码 ```python import torch import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transf 阅读全文
posted @ 2023-05-30 20:55 同淋雪 阅读(73) 评论(0) 推荐(0)
摘要: # 多分类问题实战 定义一个简单的神经网络模型,并使用SGD优化算法进行训练和测试MNIST数据集 ```python import torch import torch.nn.functional as F import torch.optim as optim """ torchvision 可 阅读全文
posted @ 2023-05-30 20:55 同淋雪 阅读(155) 评论(0) 推荐(0)
摘要: # 常见LOSS函数之Cross Entropy(交叉熵) 交叉熵是分类问题常用的损失函数。 ## 熵 熵表示稳定性或者说惊喜度,熵越高表示越稳定,其惊喜度就越低。 ![image-20230530203221815](https://gitee.com/drenched-with-snow/pic 阅读全文
posted @ 2023-05-30 20:52 同淋雪 阅读(166) 评论(0) 推荐(0)
摘要: # 反向传播 将输入值与参数用向量的形式表示,神经网络可以简化为: ![image-20230525191032420](https://gitee.com/drenched-with-snow/pic-go/raw/master/202305251921228.png) 损失函数为: ![imag 阅读全文
posted @ 2023-05-25 19:21 同淋雪 阅读(132) 评论(0) 推荐(0)
摘要: # Softmax 将输出的离散值转换成概率值,且所有情况的概率之和为1。 ![image-20230512142531121](https://gitee.com/drenched-with-snow/pic-go/raw/master/202305251845329.png) 求导 ![imag 阅读全文
posted @ 2023-05-25 18:46 同淋雪 阅读(121) 评论(0) 推荐(0)
摘要: # MSE及其梯度 ## MSE(mean squared error均方差) ![image-20230511162639392](https://gitee.com/drenched-with-snow/pic-go/raw/master/202305251842859.png) pytorch 阅读全文
posted @ 2023-05-25 18:43 同淋雪 阅读(89) 评论(0) 推荐(0)
摘要: # 多层感知机的梯度推导 ![image-20230525181251347](https://gitee.com/drenched-with-snow/pic-go/raw/master/202305251837340.png) pytorch实现 注:torch.randn(m,n)生成m行n列 阅读全文
posted @ 2023-05-25 18:37 同淋雪 阅读(18) 评论(0) 推荐(0)
摘要: # 单层感知机的梯度推导 ![image-20230525175539202](https://gitee.com/drenched-with-snow/pic-go/raw/master/202305251836396.png) w10表示前一层的第1节点和这一层的第0节点相连。 ![image- 阅读全文
posted @ 2023-05-25 18:36 同淋雪 阅读(20) 评论(0) 推荐(0)
摘要: # 激活函数及其梯度 1959年科学家对青蛙神经元的机制进行了研究,发现神经元不是对所有的输入都响应,而是只有值大于某个阈值时才会响应,且输出的值是固定的。 科学家借鉴这种机制发明了神经元模型。 这个函数在z=0处是不连续的,没法求它的导数,无法使用梯度下降进行优化。 为了解决这问题,科学家引入了新 阅读全文
posted @ 2023-05-25 18:35 同淋雪 阅读(78) 评论(0) 推荐(0)