《动手学深度学习》PyTorch实现(过拟合、欠拟合及其解决方案)
笔记整理 代码整理 L2 范数正则化(regularization) %matplotlib inline import torch import torch.nn as nn import numpy as np import sys sys.path.append(/home/kesci/input) import d2lzh1981 as d2l # L2范数正则化 def fit_and_plot_pytorch(wd): # 对权重参数衰减。权重名称一般是以weight结尾 net = nn.Linear(num_inputs, 1) nn.init
下载地址
用户评论