Skip to content

Instantly share code, notes, and snippets.

@Kaoschuks
Forked from sararob/predict.js
Created January 20, 2020 19:07
Show Gist options
  • Save Kaoschuks/c56084434a984a510fd3d73bb9629abf to your computer and use it in GitHub Desktop.
Save Kaoschuks/c56084434a984a510fd3d73bb9629abf to your computer and use it in GitHub Desktop.
// Get measurements for a new flower to generate a prediction
// The first argument is the data, and the second is the shape.
const inputData = tf.tensor2d([[4.8, 3.0, 1.4, 0.1]], [1, 4]);
// Get the highest confidence prediction from our model
const result = model.predict(inputData);
const winner = irisClasses[result.argMax().dataSync()[0]];
// Display the winner
console.log(winner);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment