| 82 | * the data as a JS Array. |
| 83 | */ |
| 84 | export 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 |