Created
March 17, 2019 14:06
-
-
Save orionpax00/7ca27e632ca69ca9cb36af553089d73a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import '@tensorflow/tf' as tf | |
| async function trainModel(model, inputs, labels) { | |
| // Prepare the model for training. | |
| model.compile({ | |
| optimizer: tf.train.adam(), | |
| loss: tf.losses.meanSquaredError, | |
| metrics: ['mse'], | |
| }); | |
| const batchSize = 28; | |
| const epochs = 50; | |
| return await model.fit(inputs, labels, { | |
| batchSize, | |
| epochs, | |
| shuffle: true, | |
| callbacks: tfvis.show.fitCallbacks( | |
| { name: 'Training Performance' }, | |
| ['loss', 'mse'], | |
| { height: 200, callbacks: ['onEpochEnd'] } | |
| ) | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment