I have a data set that I've plotted to show sales at time x over price y. I'm using a model to predict the price y over this time period.
However, it seems that no matter how much complexity I add or subtract, I can't get the model to include downward sloping gradients as part of its final output?
How might I achieve this?
An example output :
The model
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;
}
