Created
March 16, 2019 14:39
-
-
Save NMZivkovic/5bdd9fa0be36dcd20654f2f199c541d8 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* @desc trains model | |
* @return trained model | |
*/ | |
async function trainModelFunction(model, inputs, outputs, epochs) { | |
model.compile({ | |
optimizer: tf.train.adam(), | |
loss: 'categoricalCrossentropy', | |
metrics: ['accuracy'], | |
}); | |
const batchSize = 64; | |
return await model.fit(inputs, outputs, { | |
batchSize, | |
epochs, | |
shuffle: true, | |
callbacks: tfvis.show.fitCallbacks( | |
{ name: 'Training Performance' }, | |
['loss', 'accuracy'], | |
{ height: 200, callbacks: ['onEpochEnd'] } | |
) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment