图片截取自:https://www.bilibili.com/video/BV1z5411f7Bm/
理解RNN,视频是b站的,非常短,可以k一看。
1.将输入序列的每个数字转化为特征向量,
2.将标签转化为特征向量
3.自定义基于RNNcell的循环网络模型
4.根据输入序列的长度实例化网络模型
5.训练网络并在测试集上测试
6.可视化。
除此之外还需要设计随机生成训练集和测试集。
本着实事求是的原则,我们还是根据思路编程实现一下
def set_data(X):
o_X=[]
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
def set_target(X):
o_X = []
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target ==4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
if target == 9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 10:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 11:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 12:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 13:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 14:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 15:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 16:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 17:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==18:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
class number_Sum_model(torch.nn.Module):
def __init__(self,input_size, hidden_size,seq_len):
super(number_Sum_model, self).__init__()
self.rnncell = torch.nn.RNNCell(input_size=input_size, hidden_size=hidden_size, bias=False,nonlinearity='tanh')
self.linear=torch.nn.Linear(hidden_size,19)
self.sigmoid=torch.nn.Sigmoid()
self.input_size=input_size
self.norm_in=torch.nn.BatchNorm1d(input_size)
self.norm_h = torch.nn.BatchNorm1d(hidden_size)
self.seq_len=seq_len
def forward(self,X):
#print('---------input--------')
#print(X)
num=0
for i in range(self.seq_len):
x_in=X[i,:]
#print('------num %4d in seq:------'%num)
#print(x_in)
num+=1
if i==0:
h1 = self.rnncell(x_in)
else:
h1=self.rnncell(x_in,h1)
#print('=====the %4dth hide:--------'%num)
#print(h1)
#h1=torch.squeeze(self.norm_h(torch.unsqueeze(h1,dim=0)))
outh=self.linear(h1)
#print('---------out--------')
#print(outh)
#print(torch.stack(output))
return outh
if __name__=='__main__':
'''序列长度'''
seq_len=10
print('----------------------input X:-----------------')
X ,target= get_data(seq_len)
test_X,test_target=get_data(seq_len)
print(X)
#print('-----------------solved X:--------------')
train_X = set_data(X)
test_X = set_data(test_X)
#print(train_X)
target = np.array(target).reshape(-1,1)
test_target = np.array(test_target).reshape(-1, 1)
'''print('-----------------target labels:--------------')
print(target)'''
print('-----------------normalized target labels:--------------')
target = set_target(target)
test_target = set_target(test_target)
print(target.shape)
print('----------------training start---------------')
net =number_Sum_model(input_size=10,hidden_size=50,seq_len=seq_len)
if __name__=='__main__':
'''序列长度'''
seq_len=10
print('----------------------input X:-----------------')
X ,target= get_data(seq_len)
test_X,test_target=get_data(seq_len)
print(X)
#print('-----------------solved X:--------------')
train_X = set_data(X)
test_X = set_data(test_X)
#print(train_X)
target = np.array(target).reshape(-1,1)
test_target = np.array(test_target).reshape(-1, 1)
'''print('-----------------target labels:--------------')
print(target)'''
print('-----------------normalized target labels:--------------')
target = set_target(target)
test_target = set_target(test_target)
print(target.shape)
print('----------------training start---------------')
net =number_Sum_model(input_size=10,hidden_size=50,seq_len=seq_len)
epoches=1000
running_loss=0
loss_list=[]
t_loss_list=[]
optim = torch.optim.Adam(net.parameters(), lr=0.001)
loss = torch.nn.CrossEntropyLoss()
for epoch in range(epoches):
epoch_loss=0
for x,t in zip(train_X,target):
out = net.forward(x)
#print('------target------')
#print(t)
l=loss(out,t)
l.backward()
optim.step()
optim.zero_grad()
running_loss+=l
epoch_loss+=l.detach().numpy()
loss_list.append(epoch_loss)
test_loss=0
for x,t,in zip(test_X,test_target):
out=net.forward(x)
t_loss=loss(out,t)
test_loss+=t_loss.detach().numpy()
t_loss_list.append(test_loss)
if epoch %100 == 0:
print('===============epoch=%5d===================' % (epoch))
print('----------------current output:-----------------')
print(out.shape)
print('[train] [epoch:%4d/%4d] current loss: %.8f,current epoch loss:%.8f,total loss:%.8f'
% (epoch + 1, epoches, l.item(),epoch_loss, running_loss))
print('[test] accuracy in test data:%.8f %%'%(test(net, test_X, target)*100))
plt.Figure()
plt.plot(range(epoches),loss_list,label='loss in train data')
plt.plot(range(epoches),t_loss_list,label='loss in test data')
plt.legend()
plt.xlabel('epoches')
plt.ylabel('loss')
plt.show()
主要为0,这就涉及到概率的问题了,有多“主要”呢?
我设计的这个函数原理很简单,用choice实现
import random
def radom_num():
pool=[i for i in range(10)]+[0]*90
return random.choice(pool)
for i in range(10):
x=radom_num()
print(x)
有10%的概率输出0-9之间的一个数字,有90%的概率输出0,概率可以自己调,更改0的比例即可。
0
0
0
3
0
0
0
0
0
0
Process finished with exit code 0
和写过的结合起来,就可以了。
def get_data(seq_len):
outx=[]
outy=[]
for i in range(10):
for j in range(10):
tmp=[i,j]+random_num(seq_len-2)
outx.append(tmp)
outy.append(i+j)
return outx,outy
def random_num(num):
list=[]
for i in range(num):
pool=[i for i in range(10)]+[0]*90
list.append(random.choice(pool))
return list
实例化两次,得到两次不同的结果。分别作为训练集和测试集
X ,target= get_data(seq_len)
test_X,test_target=get_data(seq_len)
import random
import matplotlib.pyplot as plt
import torch
import numpy as np
class number_Sum_model(torch.nn.Module):
def __init__(self,input_size, hidden_size,seq_len):
super(number_Sum_model, self).__init__()
self.rnncell = torch.nn.RNNCell(input_size=input_size, hidden_size=hidden_size, bias=False,nonlinearity='tanh')
self.linear=torch.nn.Linear(hidden_size,19)
self.sigmoid=torch.nn.Sigmoid()
self.input_size=input_size
self.norm_in=torch.nn.BatchNorm1d(input_size)
self.norm_h = torch.nn.BatchNorm1d(hidden_size)
self.seq_len=seq_len
def forward(self,X):
#print('---------input--------')
#print(X)
num=0
for i in range(self.seq_len):
x_in=X[i,:]
#print('------num %4d in seq:------'%num)
#print(x_in)
num+=1
if i==0:
h1 = self.rnncell(x_in)
else:
h1=self.rnncell(x_in,h1)
#print('=====the %4dth hide:--------'%num)
#print(h1)
#h1=torch.squeeze(self.norm_h(torch.unsqueeze(h1,dim=0)))
outh=self.linear(h1)
#print('---------out--------')
#print(outh)
#print(torch.stack(output))
return outh
def set_data(X):
o_X=[]
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
def set_target(X):
o_X = []
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target ==4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
if target == 9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 10:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 11:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 12:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 13:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 14:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 15:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 16:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 17:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==18:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
def test(model, X, y):
T=0
for x in X:
pre_y = model(x)
max_pre_y = torch.argmax(pre_y, dim=0)
max_y = torch.argmax(y, dim=0)
acc=torch.nonzero(max_y.eq(max_pre_y)).shape[0]
T+=acc
return T/target.shape[0]
def get_data(seq_len):
outx=[]
outy=[]
for i in range(10):
for j in range(10):
tmp=[i,j]+random_num(seq_len-2)
outx.append(tmp)
outy.append(i+j)
return outx,outy
def random_num(num):
list=[]
for i in range(num):
pool=[i for i in range(10)]+[0]*90
list.append(random.choice(pool))
return list
if __name__=='__main__':
'''序列长度'''
seq_len=10
print('----------------------input X:-----------------')
X ,target= get_data(seq_len)
test_X,test_target=get_data(seq_len)
print(X)
#print('-----------------solved X:--------------')
train_X = set_data(X)
test_X = set_data(test_X)
#print(train_X)
target = np.array(target).reshape(-1,1)
test_target = np.array(test_target).reshape(-1, 1)
'''print('-----------------target labels:--------------')
print(target)'''
print('-----------------normalized target labels:--------------')
target = set_target(target)
test_target = set_target(test_target)
print(target.shape)
print('----------------training start---------------')
net =number_Sum_model(input_size=10,hidden_size=50,seq_len=seq_len)
epoches=1000
running_loss=0
loss_list=[]
t_loss_list=[]
optim = torch.optim.Adam(net.parameters(), lr=0.001)
loss = torch.nn.CrossEntropyLoss()
for epoch in range(epoches):
epoch_loss=0
for x,t in zip(train_X,target):
out = net.forward(x)
#print('------target------')
#print(t)
l=loss(out,t)
l.backward()
optim.step()
optim.zero_grad()
running_loss+=l
epoch_loss+=l.detach().numpy()
loss_list.append(epoch_loss)
test_loss=0
for x,t,in zip(test_X,test_target):
out=net.forward(x)
t_loss=loss(out,t)
test_loss+=t_loss.detach().numpy()
t_loss_list.append(test_loss)
if epoch %100 == 0:
print('===============epoch=%5d===================' % (epoch))
print('----------------current output:-----------------')
print(out.shape)
print('[train] [epoch:%4d/%4d] current loss: %.8f,current epoch loss:%.8f,total loss:%.8f'
% (epoch + 1, epoches, l.item(),epoch_loss, running_loss))
print('[test] accuracy in test data:%.8f %%'%(test(net, test_X, target)*100))
print('-------------------training ended.----------------')
print('-------------------test---------------------')
#print(loss_list)
#print(t_loss_list)
plt.Figure()
plt.plot(range(epoches),loss_list,label='loss in train data')
plt.plot(range(epoches),t_loss_list,label='loss in test data')
plt.legend()
plt.xlabel('epoches')
plt.ylabel('loss')
plt.show()
运行结果:
E:\anaconda\envs\pytorch\pythonw.exe C:/Users/lenovo/PycharmProjects/pythonProject1/deep_learning/实验七/test2.py
----------------------input X:-----------------
[[0, 0, 0, 0, 0, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 2, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 0], [0, 4, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 8, 0, 0, 0], [0, 6, 0, 6, 0, 0, 0, 0, 0, 0], [0, 7, 0, 0, 0, 8, 0, 0, 0, 0], [0, 8, 0, 0, 5, 8, 3, 0, 0, 2], [0, 9, 0, 4, 4, 0, 0, 0, 5, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 0, 0, 0, 0, 0, 9, 8, 0], [1, 3, 0, 0, 0, 0, 0, 0, 0, 0], [1, 4, 0, 0, 0, 0, 0, 0, 0, 0], [1, 5, 0, 0, 0, 9, 0, 0, 0, 0], [1, 6, 0, 0, 7, 0, 0, 0, 0, 0], [1, 7, 0, 0, 0, 0, 0, 0, 0, 0], [1, 8, 0, 0, 0, 0, 3, 0, 0, 0], [1, 9, 0, 0, 0, 0, 0, 0, 0, 0], [2, 0, 0, 0, 0, 0, 8, 0, 0, 0], [2, 1, 0, 0, 0, 0, 0, 0, 0, 0], [2, 2, 3, 0, 0, 0, 0, 0, 7, 0], [2, 3, 0, 0, 0, 7, 0, 0, 0, 0], [2, 4, 0, 0, 0, 0, 0, 0, 0, 0], [2, 5, 0, 0, 0, 0, 0, 0, 1, 0], [2, 6, 0, 0, 0, 0, 0, 0, 0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5, 0, 0, 0, 0, 0, 0, 0, 0], [9, 6, 0, 0, 0, 0, 0, 0, 0, 0], [9, 7, 0, 0, 0, 0, 2, 0, 7, 0], [9, 8, 0, 0, 0, 0, 0, 0, 0, 0], [9, 9, 0, 0, 0, 0, 0, 2, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.36215043,current epoch loss:295.49041867,total loss:295.49050903
[test] accuracy in test data:24.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.09511392,current epoch loss:57.08766888,total loss:18867.83789062
[test] accuracy in test data:55.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.00248457,current epoch loss:0.64282368,total loss:21235.42187500
[test] accuracy in test data:55.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.00137378,current epoch loss:0.20483907,total loss:22969.03125000
[test] accuracy in test data:52.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.00755595,current epoch loss:42.44274851,total loss:27933.52148438
[test] accuracy in test data:54.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.00045611,current epoch loss:0.31641294,total loss:29326.56054688
[test] accuracy in test data:56.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 0.00462130,current epoch loss:0.31649864,total loss:30451.38671875
[test] accuracy in test data:54.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.00047196,current epoch loss:2.67961690,total loss:32090.21289062
[test] accuracy in test data:53.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.00009858,current epoch loss:0.01781967,total loss:32125.25976562
[test] accuracy in test data:54.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.00035375,current epoch loss:11.14490421,total loss:33920.10546875
[test] accuracy in test data:54.00000000 %
-------------------training ended.----------------
-------------------test---------------------
这是序列长度为10的结果,
下一步是改变序列长度,再次运行,我将六个结果合到一起了。序列长度分别是5,10,15,20,25,30.
代码:
import random
import matplotlib.pyplot as plt
import torch
import numpy as np
class number_Sum_model(torch.nn.Module):
def __init__(self,input_size, hidden_size,seq_len):
super(number_Sum_model, self).__init__()
self.rnncell = torch.nn.RNNCell(input_size=input_size, hidden_size=hidden_size, bias=False,nonlinearity='tanh')
self.linear=torch.nn.Linear(hidden_size,19)
self.sigmoid=torch.nn.Sigmoid()
self.input_size=input_size
self.norm_in=torch.nn.BatchNorm1d(input_size)
self.norm_h = torch.nn.BatchNorm1d(hidden_size)
self.seq_len=seq_len
def forward(self,X):
#print('---------input--------')
#print(X)
num=0
for i in range(self.seq_len):
x_in=X[i,:]
#print('------num %4d in seq:------'%num)
#print(x_in)
num+=1
if i==0:
h1 = self.rnncell(x_in)
else:
h1=self.rnncell(x_in,h1)
#print('=====the %4dth hide:--------'%num)
#print(h1)
#h1=torch.squeeze(self.norm_h(torch.unsqueeze(h1,dim=0)))
outh=self.linear(h1)
#print('---------out--------')
#print(outh)
#print(torch.stack(output))
return outh
def set_data(X):
o_X=[]
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
def set_target(X):
o_X = []
for x in X:
target_list = []
for target in x:
if target == 0:
target_list.append(torch.Tensor([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 1:
target_list.append(torch.Tensor([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 2:
target_list.append(torch.Tensor([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 3:
target_list.append(torch.Tensor([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target ==4:
target_list.append(torch.Tensor([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 5:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 6:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 7:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 8:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
if target == 9:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 10:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
elif target == 11:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
elif target == 12:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
elif target == 13:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]))
elif target == 14:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]))
elif target == 15:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]))
elif target == 16:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]))
elif target == 17:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]))
elif target==18:
target_list.append(torch.Tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]))
X_list = torch.stack(target_list)
o_X.append(X_list)
output=torch.stack(o_X)
return torch.squeeze(output)
def test(model, X, y):
T=0
for x in X:
pre_y = model(x)
max_pre_y = torch.argmax(pre_y, dim=0)
max_y = torch.argmax(y, dim=0)
acc=torch.nonzero(max_y.eq(max_pre_y)).shape[0]
T+=acc
return T/target.shape[0]
def get_data(seq_len):
outx=[]
outy=[]
for i in range(10):
for j in range(10):
tmp=[i,j]+random_num(seq_len-2)
outx.append(tmp)
outy.append(i+j)
return outx,outy
def random_num(num):
list=[]
for i in range(num):
pool=[i for i in range(10)]+[0]*90
list.append(random.choice(pool))
return list
if __name__=='__main__':
'''序列长度'''
len_list=[5,10,15,20,25,30]
plt.Figure()
for i,len in enumerate(len_list):
print('--------current seq_lenth:---------')
print(len)
seq_len=len
print('----------------------input X:-----------------')
X ,target= get_data(seq_len)
test_X,test_target=get_data(seq_len)
print(X)
#print('-----------------solved X:--------------')
train_X = set_data(X)
test_X = set_data(test_X)
#print(train_X)
target = np.array(target).reshape(-1,1)
test_target = np.array(test_target).reshape(-1, 1)
'''print('-----------------target labels:--------------')
print(target)'''
print('-----------------normalized target labels:--------------')
target = set_target(target)
test_target = set_target(test_target)
print(target.shape)
print('----------------training start---------------')
net =number_Sum_model(input_size=10,hidden_size=50,seq_len=seq_len)
epoches=1000
running_loss=0
loss_list=[]
t_loss_list=[]
optim = torch.optim.Adam(net.parameters(), lr=0.001)
loss = torch.nn.CrossEntropyLoss()
for epoch in range(epoches):
epoch_loss=0
for x,t in zip(train_X,target):
out = net.forward(x)
#print('------target------')
#print(t)
l=loss(out,t)
l.backward()
optim.step()
optim.zero_grad()
running_loss+=l
epoch_loss+=l.detach().numpy()
loss_list.append(epoch_loss)
test_loss=0
for x,t,in zip(test_X,test_target):
out=net.forward(x)
t_loss=loss(out,t)
test_loss+=t_loss.detach().numpy()
t_loss_list.append(test_loss)
if epoch %100 == 0:
print('===============epoch=%5d===================' % (epoch))
print('----------------current output:-----------------')
print(out.shape)
print('[train] [epoch:%4d/%4d] current loss: %.8f,current epoch loss:%.8f,total loss:%.8f'
% (epoch + 1, epoches, l.item(),epoch_loss, running_loss))
print('[test] accuracy in train data:%.8f %%'%(test(net, X, target)*100))
print('[test] accuracy in test data:%.8f %%' % (test(net, test_X, test_target) * 100))
print('-------------------training ended.----------------')
print('-------------------test---------------------')
plt.subplot(2,3,i+1)
plt.plot(range(epoches),loss_list,label='loss in train data')
plt.plot(range(epoches),t_loss_list,label='loss in test data')
plt.legend()
plt.xlabel('epoches')
plt.ylabel('loss')
plt.title('seq_lenth={}'.format(seq_len))
plt.show()
E:\anaconda\envs\pytorch\pythonw.exe C:/Users/lenovo/PycharmProjects/pythonProject1/deep_learning/实验七/test2.py
--------current seq_lenth:---------
5
----------------------input X:-----------------
[[0, 0, 0, 0, 0], [0, 1, 0, 8, 0], [0, 2, 0, 0, 0], [0, 3, 0, 0, 0], [0, 4, 0, 0, 0], [0, 5, 0, 0, 0], [0, 6, 0, 0, 0], [0, 7, 0, 0, 0], [0, 8, 0, 7, 0], [0, 9, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 0, 0, 0], [1, 2, 0, 0, 0], [1, 3, 0, 0, 0], [1, 4, 0, 0, 0], [1, 5, 0, 0, 0], [1, 6, 0, 0, 0], [1, 7, 9, 0, 0], [1, 8, 0, 0, 0], [1, 9, 0, 0, 0], [2, 0, 0, 3, 0], [2, 1, 0, 0, 0], [2, 2, 0, 0, 0], [2, 3, 0, 0, 0], [2, 4, 0, 0, 0], [2, 5, 0, 0, 0], [2, 6, 0, 0, 0], [2, 7, 0, 0, 0], [2, 8, 0, 9, 3], [2, 9, 0, 0, 0], [3, 0, 0, 0, 8], [3, 1, 0, 0, 0], [3, 2, 0, 0, 0], [3, 3, 0, 0, 0], [3, 4, 0, 0, 0], [3, 5, 0, 0, 0], [3, 6, 0, 0, 0], [3, 7, 0, 0, 0], [3, 8, 0, 0, 0], [3, 9, 0, 0, 0], [4, 0, 0, 0, 0], [4, 1, 0, 0, 0], [4, 2, 0, 0, 0], [4, 3, 0, 0, 0], [4, 4, 0, 0, 0], [4, 5, 7, 0, 0], [4, 6, 0, 0, 0], [4, 7, 0, 0, 0], [4, 8, 0, 0, 0], [4, 9, 3, 0, 0], [5, 0, 0, 0, 0], [5, 1, 0, 0, 3], [5, 2, 5, 4, 0], [5, 3, 0, 0, 0], [5, 4, 0, 0, 0], [5, 5, 0, 0, 0], [5, 6, 0, 0, 0], [5, 7, 2, 0, 0], [5, 8, 0, 0, 0], [5, 9, 0, 0, 0], [6, 0, 0, 0, 0], [6, 1, 0, 0, 0], [6, 2, 0, 0, 0], [6, 3, 0, 0, 0], [6, 4, 0, 0, 0], [6, 5, 0, 0, 0], [6, 6, 0, 0, 0], [6, 7, 0, 7, 0], [6, 8, 0, 0, 0], [6, 9, 0, 8, 0], [7, 0, 0, 0, 0], [7, 1, 3, 0, 0], [7, 2, 0, 0, 6], [7, 3, 0, 0, 0], [7, 4, 0, 0, 0], [7, 5, 0, 0, 0], [7, 6, 0, 0, 0], [7, 7, 0, 0, 0], [7, 8, 0, 9, 0], [7, 9, 0, 0, 0], [8, 0, 0, 0, 0], [8, 1, 0, 0, 2], [8, 2, 0, 0, 0], [8, 3, 0, 0, 3], [8, 4, 0, 0, 0], [8, 5, 8, 0, 0], [8, 6, 0, 0, 0], [8, 7, 0, 2, 0], [8, 8, 0, 0, 0], [8, 9, 0, 0, 0], [9, 0, 0, 0, 3], [9, 1, 1, 0, 0], [9, 2, 0, 0, 0], [9, 3, 0, 0, 0], [9, 4, 0, 0, 0], [9, 5, 0, 0, 0], [9, 6, 0, 5, 0], [9, 7, 0, 0, 0], [9, 8, 0, 0, 0], [9, 9, 5, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.28226900,current epoch loss:295.12386799,total loss:295.12387085
[test] accuracy in test data:97.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.18418270,current epoch loss:74.12133465,total loss:12747.37109375
[test] accuracy in test data:48.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.01832098,current epoch loss:14.72891339,total loss:17823.52929688
[test] accuracy in test data:55.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.00076027,current epoch loss:3.29078604,total loss:19745.34375000
[test] accuracy in test data:55.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.00124377,current epoch loss:0.47318420,total loss:20224.65625000
[test] accuracy in test data:54.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.00043478,current epoch loss:0.11461946,total loss:20710.58984375
[test] accuracy in test data:54.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 0.00022421,current epoch loss:0.07011100,total loss:21236.75585938
[test] accuracy in test data:54.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.00001431,current epoch loss:0.00348152,total loss:21237.59960938
[test] accuracy in test data:54.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.00003254,current epoch loss:0.07869509,total loss:22092.42968750
[test] accuracy in test data:54.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.00001049,current epoch loss:0.00137137,total loss:22093.37500000
[test] accuracy in test data:54.00000000 %
-------------------training ended.----------------
-------------------test---------------------
--------current seq_lenth:---------
10
----------------------input X:-----------------
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 9, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 0, 8], [0, 3, 0, 0, 0, 0, 0, 0, 8, 1], [0, 4, 0, 0, 0, 0, 0, 0, 7, 0], [0, 5, 0, 0, 0, 4, 0, 0, 0, 0], [0, 6, 0, 0, 0, 0, 7, 0, 0, 0], [0, 7, 0, 0, 0, 0, 4, 0, 0, 0], [0, 8, 0, 5, 0, 0, 0, 0,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, 7, 0, 0, 0, 8, 0, 0, 0, 0], [7, 8, 0, 0, 0, 2, 0, 0, 0, 0], [7, 9, 2, 0, 0, 0, 0, 0, 0, 0], [8, 0, 0, 1, 2, 0, 0, 0, 0, 0], [8, 1, 0, 0, 0, 0, 0, 8, 0, 0], [8, 2, 7, 0, 0, 0, 0, 0, 0, 8], [8, 3, 0, 0, 0, 0, 0, 0, 0, 0], [8, 4, 0, 0, 0, 0, 0, 4, 0, 0], [8, 5, 0, 0, 0, 0, 0, 0, 0, 0], [8, 6, 0, 0, 0, 1, 6, 0, 0, 0], [8, 7, 0, 0, 0, 0, 0, 1, 0, 0], [8, 8, 0, 0, 0, 0, 0, 0, 0, 0], [8, 9, 0, 0, 0, 0, 0, 5, 0, 0], [9, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 1, 0, 0, 0, 0, 0, 0, 0, 0], [9, 2, 0, 7, 0, 0, 0, 0, 6, 0], [9, 3, 0, 0, 0, 0, 0, 0, 0, 0], [9, 4, 0, 0, 0, 0, 0, 0, 0, 0], [9, 5, 0, 0, 0, 0, 0, 0, 0, 0], [9, 6, 0, 0, 0, 0, 7, 0, 0, 0], [9, 7, 0, 0, 0, 0, 0, 0, 0, 0], [9, 8, 4, 0, 0, 0, 0, 0, 0, 0], [9, 9, 3, 0, 0, 0, 0, 0, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.51502323,current epoch loss:295.48968387,total loss:295.48965454
[test] accuracy in test data:100.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.24453865,current epoch loss:6.13406910,total loss:10920.70898438
[test] accuracy in test data:60.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.05279072,current epoch loss:12.04772364,total loss:12690.75878906
[test] accuracy in test data:59.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.00055322,current epoch loss:0.03329724,total loss:12817.30761719
[test] accuracy in test data:60.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.00421635,current epoch loss:0.50351729,total loss:14388.89160156
[test] accuracy in test data:60.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.00924426,current epoch loss:1.12069044,total loss:15517.47558594
[test] accuracy in test data:62.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 0.00006830,current epoch loss:0.00898683,total loss:15531.74804688
[test] accuracy in test data:62.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.00000262,current epoch loss:0.00014234,total loss:15531.74804688
[test] accuracy in test data:62.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.00688407,current epoch loss:0.10427206,total loss:17823.39843750
[test] accuracy in test data:58.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.00004458,current epoch loss:0.00126730,total loss:17824.39062500
[test] accuracy in test data:59.00000000 %
-------------------training ended.----------------
-------------------test---------------------
--------current seq_lenth:---------
15
----------------------input X:-----------------
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0], [0, 4, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0], [0, 5, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 0, 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, 6, 0, 0, 4, 0, 0, 0, 0, 0, 0], [9, 8, 0, 0, 8, 0, 0, 3, 0, 0, 0, 0, 0, 0, 9], [9, 9, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.34767389,current epoch loss:295.39735246,total loss:295.39730835
[test] accuracy in test data:89.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.13090569,current epoch loss:38.30660608,total loss:16716.73437500
[test] accuracy in test data:56.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.01099622,current epoch loss:8.04670105,total loss:20273.48242188
[test] accuracy in test data:55.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.01017691,current epoch loss:3.33015038,total loss:22444.95703125
[test] accuracy in test data:58.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.00273259,current epoch loss:1.80823926,total loss:24169.60742188
[test] accuracy in test data:58.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.00062863,current epoch loss:0.84675906,total loss:25506.07031250
[test] accuracy in test data:52.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 0.00142723,current epoch loss:0.47099411,total loss:27496.17187500
[test] accuracy in test data:55.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.00116078,current epoch loss:7.94065304,total loss:30104.80664062
[test] accuracy in test data:56.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.00518655,current epoch loss:15.20385200,total loss:32090.19921875
[test] accuracy in test data:58.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.01120135,current epoch loss:0.77374000,total loss:33598.61718750
[test] accuracy in test data:59.00000000 %
-------------------training ended.----------------
-------------------test---------------------
--------current seq_lenth:---------
20
----------------------input X:-----------------
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 4, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0], [0, 4, 0, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2], [0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 6, 0, 0, 8, 0], [0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], [1, 2, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0], [1, 3, 0, 7, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 4, 0], [1, 4, 0, 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 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.34720039,current epoch loss:294.90740776,total loss:294.90737915
[test] accuracy in test data:100.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.04119691,current epoch loss:26.25565190,total loss:13728.62402344
[test] accuracy in test data:59.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.00519414,current epoch loss:3.11387142,total loss:16199.69042969
[test] accuracy in test data:63.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.00572565,current epoch loss:3.76640090,total loss:19884.80273438
[test] accuracy in test data:59.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.00124079,current epoch loss:0.72027978,total loss:21676.64257812
[test] accuracy in test data:64.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.00936768,current epoch loss:33.76780747,total loss:24601.87500000
[test] accuracy in test data:66.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 9.48542500,current epoch loss:271.24230704,total loss:25626.24414062
[test] accuracy in test data:47.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.00057788,current epoch loss:0.06571352,total loss:27105.81250000
[test] accuracy in test data:58.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.00081137,current epoch loss:0.11322398,total loss:28889.08984375
[test] accuracy in test data:65.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.00030835,current epoch loss:0.13010541,total loss:30730.45703125
[test] accuracy in test data:55.00000000 %
-------------------training ended.----------------
-------------------test---------------------
--------current seq_lenth:---------
25
----------------------input X:-----------------
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 9, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0], [0, 5, 0, 0, 6, 0, 9, 0, 0, 0, 0, 0, 6, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 6, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 8, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 5, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [9, 7, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0], [9, 8, 0, 0, 9, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0], [9, 9, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.74194241,current epoch loss:293.34709311,total loss:293.34716797
[test] accuracy in test data:4.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 3.40367341,current epoch loss:177.66759386,total loss:25189.40820312
[test] accuracy in test data:61.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.61840701,current epoch loss:18.06161785,total loss:33828.57812500
[test] accuracy in test data:63.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 3.06319594,current epoch loss:115.08253594,total loss:40134.09375000
[test] accuracy in test data:58.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.71040797,current epoch loss:17.05846825,total loss:47835.60937500
[test] accuracy in test data:60.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 0.10992918,current epoch loss:6.26255406,total loss:51182.86328125
[test] accuracy in test data:60.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 2.58084583,current epoch loss:43.89258687,total loss:54642.29687500
[test] accuracy in test data:68.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.04045373,current epoch loss:3.15761237,total loss:57390.00390625
[test] accuracy in test data:57.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.14898381,current epoch loss:27.25413477,total loss:60886.96093750
[test] accuracy in test data:67.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.25875017,current epoch loss:17.47668387,total loss:63595.76562500
[test] accuracy in test data:63.00000000 %
-------------------training ended.----------------
-------------------test---------------------
--------current seq_lenth:---------
30
----------------------input X:-----------------
[[0, 0, 0, 1, 0, 6, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 6, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 8, 0, 0, 0, 0, 0, 0], [0, 4, 0, 1, 0, 0, 8, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 5, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 4], [0, 6, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6], [9, 8, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0], [9, 9, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
-----------------normalized target labels:--------------
torch.Size([100, 19])
----------------training start---------------
===============epoch= 0===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 1/1000] current loss: 3.37954950,current epoch loss:296.45657706,total loss:296.45660400
[test] accuracy in test data:83.00000000 %
===============epoch= 100===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 101/1000] current loss: 0.44620934,current epoch loss:19.82598441,total loss:14567.10449219
[test] accuracy in test data:39.00000000 %
===============epoch= 200===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 201/1000] current loss: 0.05403009,current epoch loss:1.80037296,total loss:18393.91992188
[test] accuracy in test data:38.00000000 %
===============epoch= 300===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 301/1000] current loss: 0.75937688,current epoch loss:50.92073171,total loss:25190.05664062
[test] accuracy in test data:45.00000000 %
===============epoch= 400===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 401/1000] current loss: 0.05475140,current epoch loss:1.28522995,total loss:28065.24023438
[test] accuracy in test data:52.00000000 %
===============epoch= 500===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 501/1000] current loss: 4.47472906,current epoch loss:263.24490893,total loss:33662.23437500
[test] accuracy in test data:84.00000000 %
===============epoch= 600===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 601/1000] current loss: 0.64409089,current epoch loss:46.71862814,total loss:48807.29687500
[test] accuracy in test data:50.00000000 %
===============epoch= 700===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 701/1000] current loss: 0.20868133,current epoch loss:57.47974400,total loss:53946.56250000
[test] accuracy in test data:52.00000000 %
===============epoch= 800===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 801/1000] current loss: 0.79309320,current epoch loss:34.87793737,total loss:61046.73046875
[test] accuracy in test data:50.00000000 %
===============epoch= 900===================
----------------current output:-----------------
torch.Size([19])
[train] [epoch: 901/1000] current loss: 0.38964942,current epoch loss:27.58768577,total loss:65663.45312500
[test] accuracy in test data:48.00000000 %
-------------------training ended.----------------
-------------------test---------------------
Process finished with exit code 0
注:图片中的title标签没整对,但是已经把代码改正了,只是没有再运行一次。
总结:我做实验只迭代了1000次,我看邱老师迭代了怎么那么多次,20000次,他也是慢慢等的吗。我这六个序列长度,每个1000次就等不及了。。。
实验表明了一种现象,SRN不能支持较长序列的训练过程,就像神经网络不能层数过深一样,他们之间的原因是否有联系呢?以后我们会学到。
就像得了阿兹海默综合征的老爷爷一样,SRN遇到长序列就不能记住前面的数据信息,随着序列长度越长,对它的记忆越”模糊“。