线性回归代码实战
线性回归代码实战引入库函数1234### 引入库函数 import torch import matplotlib.pyplot as plt # 作图 import random # 产生随机数 在这一步中,我们引入了三个库:torch 是 PyTorch 深度学习框架,用于构建和训练模型;matplotlib.pyplot 用于绘制图形,方便我们可视化数据和模型结果;random 用于生成随机数,在后续的数据处理中会用到。 生成数据集12345678910111213141516171819202122### 生成数据集 输入真实 w 和 b以及数据量data_numdef generateDataSet(w, b, data_num): x = torch.normal(0, 1, (data_num, len(w))) # std: 0, mean: 1, shape() y = torch.matmul(x, w) + b # matmul函数实现矩阵相乘 # 添加噪声 noise =...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post1$ hexo new "My New Post" More info: Writing Run server1$ hexo server More info: Server Generate static files1$ hexo generate More info: Generating Deploy to remote sites1$ hexo deploy More info: Deployment


