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

Function flatOneHot

iris-fitDataset/data.js:84–91  ·  view source on GitHub ↗
(idx)

Source from the content-addressed store, hash-verified

82 * the data as a JS Array.
83 */
84export function flatOneHot(idx) {
85 // TODO(bileschi): Remove 'Array.from' from here once tf.data supports typed
86 // arrays https://github.com/tensorflow/tfjs/issues/1041
87 // TODO(bileschi): Remove '.dataSync()' from here once tf.data supports
88 // datasets built from tensors.
89 // https://github.com/tensorflow/tfjs/issues/1046
90 return Array.from(tf.oneHot([idx], 3).dataSync());
91}
92
93/**
94 * Obtains Iris data, split into training and test sets and with the label

Callers 1

getIrisDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected