Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @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'] }
- )
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement