lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.37k forks source link

Course 1 (Tensorflow JS) - Week 1 - TF Deployment #92

Open ValeriVoev opened 4 years ago

ValeriVoev commented 4 years ago

There is a function defined in FirstHTML.html in the Examples as follows:

async function doTraining(model){
            const history = 
                  await model.fit(xs, ys, 
                        { epochs: 500,
                          callbacks:{
                              onEpochEnd: async(epoch, logs) =>{
                                  console.log("Epoch:" 
                                              + epoch 
                                              + " Loss:" 
                                              + logs.loss);

                              }
                          }
                        });
        }

The issue is that xs and ys are globally defined variables and this function is not self-contained as is. Shouldn't xs and ys be passed as function arguments rather than as global variables?