MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / predictHandler

Function predictHandler

data-generator/index.js:198–204  ·  view source on GitHub ↗

* Applies the model to the manually entered hand value and updates the UI with * the model's prediction.

()

Source from the content-addressed store, hash-verified

196 * the model's prediction.
197 */
198function predictHandler() {
199 const cards = ui.getInputCards();
200 const features =
201 gameToFeaturesAndLabel({player1Hand: cards, player1Win: 1}).xs;
202 const output = GLOBAL_MODEL.predict(features.expandDims(0));
203 ui.displayPrediction(`${output.dataSync()[0].toFixed(3)}`);
204}
205
206/**
207 * Updates the game constant controlling the number of cards per hand and

Callers 1

Calls 2

gameToFeaturesAndLabelFunction · 0.85
predictMethod · 0.45

Tested by

no test coverage detected