seq2seq优化思路

问题:
1. 程序添加测试集对模型进行离线验证,加上评价指标rmse
上次写的测试部分,数据来自训练集。
2. 添加网格搜索和交叉验证

RMSE函数

‘’’
from sklearn.metrics import mean_squared_error
import numpy as np
import sklearn.metrics as sm

def rmse(y_true, y_pred):
return np.sqrt(mean_squared_error(y_true, y_pred))

‘’’

需要搜索的参数:

1
2
3
4
5
6
7
8
9
10
batch_size = 5  # Low value used for live demo purposes - 100 and 1000 would be possible too, crank that up!
hidden_dim = 12 # Count of hidden neurons in the recurrent units.
layers_stacked_count = 2 # Number of stacked recurrent cells, on the neural depth axis.


learning_rate = 0.007 # Small lr helps not to diverge during training.
nb_iters = 300 # How many times we perform a training step (therefore how many times we show a batch).
lr_decay = 0.92 # default: 0.9 . Simulated annealing.
momentum = 0.5 # default: 0.0 . Momentum technique in weights update
lambda_l2_reg = 0.003 # L2 regularization of weights - avoids overfitting

交叉验证资料

k可不可以放到网格搜索里面呢?

https://zhuanlan.zhihu.com/p/24825503