Day 5 Code

July 09, 2018 | #100DaysOfMLCode |

Back to List

Day 5: Intelligence and Learning

(Depending on your browser version TensorFlow.JS may not work)

predict() allows you to pass in data and the neural network will then predict the outputs

fit() - gives the model an idea of what the output should be given the inputs

  • You will have 2 kinds of data the input (x) and the output(y)
  • Input(X):
  •  
  • Known outputs(Y):
  •  
  • History - an object that is returned about how the training is going
  • batchSize - the amount of data points that will go through the model before it calculates new weights
  • epochs - the number of times to go through the training data(default is 1)
  • If you want to fit multiple data sets you need to put it in an async function and then have await before fitting data
  • async function(){const response = await model.fit(x, y);}
  • If you are training with the same data it is good to shuffle the inputs around so the model will learn faster: "shuffle: true"

Outputs after training(To see loss over time press F12 on your computer keyboard to view console, currently set to 100 loops through training with the training data passed in 10 times, effectively 10,000 times to train)

Generated outputs are based off the Tensors above