Categories
Misc

Problem/Confusion with fit callbacks (Tensorflow js)

Hi!

I come from python and wanted to test some client side ML with TensorFlow js. During the fit process I noticed some unexpected behaviour with some callbacks getting called and others not and some callbacks not receiving data.

Here my short example:

“`javascript model.fit(X, y, { callbacks: {

// called but empty logs object? (okay because no data available yet) onTrainBegin: (logs) => { console.log('TrainBegin'); console.log(logs); }, // called but empty logs object? (why?? Training is over and it should have data) onTrainEnd: (logs) => { console.log('TrainEnd'); console.log(logs); }, // never called??? onEpochStart: (epoch, logs) => { console.log('EpochStart'); console.log(`Epoch ${epoch}: loss = ${logs.loss}; accuracy = ${logs.acc}`); }, // works! onEpochEnd: (epoch, logs) => { console.log('EpochEnd'); console.log(`Epoch ${epoch}: loss = ${logs.loss}; accuracy = ${logs.acc}`); }, // never called??? onBatchStart: (batch, logs) => { console.log('BatchStart'); console.log(`Batch ${batch}: loss = ${logs.loss}; accuracy = ${logs.acc}`); }, // works! onBatchEnd: (batch, logs) => { console.log('BatchEnd'); console.log(`Batch ${batch}: loss = ${logs.loss}; accuracy = ${logs.acc}`); }, 

}, }); “`

I looked through the documentation but could not find an explanation for this behaviour. Does anyone have any ideas and can enlighten me? 😀

submitted by /u/JulianCologne
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *