Questions tagged «perceptron»

2
训练时间过长,Adam优化器的行为异常
我正在尝试在64个随机生成的数据点上训练单个感知器(1000个输入单元,1个输出,没有隐藏层)。我正在使用Adam优化器使用Pytorch: import torch from torch.autograd import Variable torch.manual_seed(545345) N, D_in, D_out = 64, 1000, 1 x = Variable(torch.randn(N, D_in)) y = Variable(torch.randn(N, D_out)) model = torch.nn.Linear(D_in, D_out) loss_fn = torch.nn.MSELoss(size_average=False) optimizer = torch.optim.Adam(model.parameters()) for t in xrange(5000): y_pred = model(x) loss = loss_fn(y_pred, y) print(t, loss.data[0]) optimizer.zero_grad() loss.backward() optimizer.step() 最初,损耗迅速降低,如预期的那样: …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.