May 2020
Intermediate to advanced
404 pages
10h 52m
English
Let's begin by reading the data we have stored in the iris variable to a tensor2d object:
const trainingData = tf.tensor2d(iris.map(item=> [ item.sepal_length, item.sepal_width, item.petal_length, item.petal_width]),[144,4])
We do not have any test data yet; this will be provided by the user.
const outputData = tf.tensor2d(iris.map(item => [ item.species === 'setosa' ? 1 : 0, item.species === 'virginica' ? 1 : 0, item.species === 'versicolor' ? 1 : 0]), [144,3])
We are now ready to create the model for training. The following code might remind you of the code we used in the previous chapter ...
Read now
Unlock full access