코드 2-17 모델 가중치 출력하기
let trainLogs = [];
await model.fit(tensors.trainFeatures, tensors.trainTarget, {
batchSize: BATCH_SIZE,
epochs: NUM_EPOCHS,
validationSplit: 0.2,
callbacks: {
onEpochEnd: async (epoch, logs) => {
await ui.updateModelStatus(
'에포크 ${NUM_EPOCHS}번 중 ${epoch + 1}번째 완료.', modelName);
trainLogs.push(logs);
tfvis.show.history(container, trainLogs, ['loss', 'val_loss'],
{'xLabel':'반복(에포크)','yLabel':'손실'})
if (weightsIllustration) {
model.layers[0].getWeights()[0].data().then(kernelAsArr => {
const weightsList = describeKernelElements(kernelAsArr);
ui.updateWeightDescription(weightsList);
});
}
}
}
});