我有一个数据集,我已经绘制,以显示在时间x的销售额超过价格y。我用一个模型来预测这段时间内的价格y。
然而,似乎无论我加上或减去多少复杂度,我都不能让模型将向下倾斜的梯度作为其最终输出的一部分?
我怎样才能做到这一点?
输出示例:
模型
function createModel() {
const model = tf.sequential();
//adding a layer
model.add(tf.layers.dense({
units: 5, //number of nodes in layer
useBias: true, //adds a bias parameter
activation: 'tanh', //activation function
inputDim: 1, //amount of inputs
}));
//not an input layer so has no inputDim property
model.add(tf.layers.dense({
units: 10, //number of nodes in layer
useBias: true, //adds a bias parameter
activation: 'softmax', //activation function
}));
model.add(tf.layers.dense({
units: 10, //number of nodes in layer
useBias: true, //adds a bias parameter
activation: 'sigmoid', //activation function
}));
model.add(tf.layers.dense({
units: 5, //number of nodes in layer
useBias: true, //adds a bias parameter
activation: 'tanh', //activation function
}));
//output layer with one node
model.add(tf.layers.dense({
units: 1, //number of nodes in layer
useBias: true, //adds a bias parameter
activation: 'tanh', //activation function
}));
const optimizer = tf.train.adam(0.1); //parameter = learning rate
model.compile({
loss: 'meanSquaredError',
optimizer
})
return model;
}
暂无答案!
目前还没有任何答案,快来回答吧!