Created
March 30, 2018 18:02
-
-
Save sararob/f4104d792c65b92dbc2ea31388de6880 to your computer and use it in GitHub Desktop.
Make a prediction on a TensorFlow.js model, details here: https://medium.com/tensorflow/introducing-tensorflow-js-machine-learning-in-javascript-bf3eab376db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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