ozskywalker / tensorflow_experiments

0 stars 0 forks source link

TFJS not loading web form data into correct shape #1

Open ozskywalker opened 4 years ago

ozskywalker commented 4 years ago

When attempting to create the tensor so I can perform a prediction run, I receive the following error message:

Error: Error when checking : expected dense_3_input to have shape [null,9] but got array with shape [2,0].

Have tried variations of tf.tensor(), tensor1d(), tensor2d(), and creating various shapes, but still cannot determine why I'm not creating a [null, 9] shape, or if perhaps my original model is broken and needs to be modified & re-exported.

File: poc/02_auto_mpg/src/App.js

Code Snippet

        // prepare data into a "tensor"
        // then run prediction

        const tensor = tf.tensor2d([[], [cyl, disp, hp, weight, accel, year, data["USA"], data["Europe"], data["Japan"]]]);
        const prediction = this.state.model.predict(tensor);
ozskywalker commented 4 years ago

Abandoning tfjs approach and building backend API with Python & Flask. Will keep this issue open to document those changes.

Todo: