Steps to use a ML model in TensorflowJS
TensorFlow.js — Making Predictions from 2D Data | Google Codelabs
1: Create the model
Creates a sequential model with a Dense Layer.
Add layers
This adds an input layer to the network. That input layer is connected to a dense layer.
You also define the inputShape.
Then define the output layer. units
is 1
because it should output 1
number.
2: Prepare the data
It is best practice to perform shuffling and normalisation on training data.
Data needs to be converted to tensors to make training models practical.
3: Compile and train the model
Compile it with optimizer function and a loss function.
Also specify batch size and number of epochs.
4: Make predictions
This renders a scatterplot like so: