Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140273

Tensor flow cant work out correct inputshape

$
0
0

Below is my code and I cant figure what I need the input shape to be My training data X looks like this: its an array of arrays each single array has 8 numbers between 0 and 1 I create it by creating a single array with 8 numbers and then i push that array into another array.

I then use tf.ones to make the array readable for the tensor flow model because I get another error if I just use the array of arrays instead of doing this.

My Y is very much the same an array or arrays however in this one each array only has number which is the desired output of the model.

Everytime I try to fit my data i get this error: Unhandled Rejection (Error): new shape and old shape must have the same number of elements.

Any help would be greatly appreciated !!

 const model = tf.sequential();
        model.add(tf.layers.dense({units: 10, activation:'sigmoid',inputShape:[10] }));
        model.add(tf.layers.dense({units: 1, activation:'sigmoid'}));
        model.compile({loss: 'meanSquaredError', optimizer: 'sgd'});
        const x = tf.ones([this.state.testingData]);

        const y =tf.ones([this.state.testingDataY]);
        // console.log(this.state.testingData);
        model.fit(x, y)
        this.setState({model:'complete'});

Viewing all articles
Browse latest Browse all 140273

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>