如何将向下倾斜的粒度整合到我的机器学习tensorflow.js算法中?

ni65a41a  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(198)

我有一个数据集,我已经绘制,以显示在时间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;
        }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题