我有以下模型:
var model = tf.sequential();
model.add(tf.layers.dense({inputShape : [1], units : 9, activation: 'sigmoid'}));
model.add(tf.layers.reshape({targetShape: [3,3]}));
model.add(tf.layers.lstm({
units: 9,
recurrentInitializer: 'glorotNormal',
activation: 'sigmoid'
}));
model.add(tf.layers.dense({units : 1, activation: 'sigmoid'}));
model.compile({
loss: 'meanSquaredError',
optimizer: 'adam',
metrics: ['accuracy']
});
我像下面这样训练它:
var t0 = performance.now();
const history = await model.fit(xTrain, yTrain, {
epochs: 1,
batchSize : 128
});
yPredict = model.predict(xPredict).as1D();
var t1 = performance.now();
对我自己的render()函数的调用显示,即使经过10个时间段 我只有一条直线,没有在xTrain / yTrain中插入正弦函数。 xTrain / yTrain是具有1000个样本的正弦函数