async train(){
        if(this.type == "keras")
            throw "Keras type model cannot be trained";

        let loadTrainData = await this.data.toTrain(this.model);
        
        let batchSize = Math.floor(
            loadTrainData.images.shape[0] * this.batchSizeFraction
        );

        if (!(batchSize > 0)) 
            throw "Batch size is 0 or NaN. Please choose a non-zero fraction.";
        
        let shuffledIndices = new Int32Array(
            tf.util.createShuffledIndices(loadTrainData.labels.shape[0])
        );
        
        console.time("Training Time");
        return this.model.fit(
            loadTrainData.images.gather(shuffledIndices),
            loadTrainData.labels.gather(shuffledIndices),
            {
                batchSize,
                epochs: this.epochs,
                validationSplit: 0.15,
                callbacks: tf.node.tensorBoard("/tmp/tf_fit_logs")
                /*callbacks: {
                    onBatchEnd: async (batch, logs) => {
                        //console.log("Loss: " + logs.loss.toFixed(5));
                    },
                    onTrainEnd: async logs => {
                        console.timeEnd("Training Time");
                    }
                }*/
            }
        );
    }
/**
     * Function to perform data training
     * 
     * @return Promise
     */
Function to perform data training

@return Promise
Function to perform data training @return Promise
async train(){
        if(this.type == "keras")
            throw "Keras type model cannot be trained";
        let loadTrainData = await this.data.toTrain(this.model);
        let batchSize = Math.floor(
            loadTrainData.images.shape[0] * this.batchSizeFraction
        );
        if (!(batchSize > 0)) 
            throw "Batch size is 0 or NaN. Please choose a non-zero fraction.";
        let shuffledIndices = new Int32Array(
            tf.util.createShuffledIndices(loadTrainData.labels.shape[0])
        );
        console.time("Training Time");
        return this.model.fit(
            loadTrainData.images.gather(shuffledIndices),
            loadTrainData.labels.gather(shuffledIndices),
            {
                batchSize,
                epochs: this.epochs,
                validationSplit: 0.15,
                callbacks: tf.node.tensorBoard("/tmp/tf_fit_logs")
            }
        );
    }
async train ( ) { if ( this . type == "keras" ) throw "Keras type model cannot be trained" ; let loadTrainData = await this . data . toTrain ( this . model ) ; let batchSize = Math . floor ( loadTrainData . images . shape [ 0 ] * this . batchSizeFraction ) ; if ( ! ( batchSize > 0 ) ) throw "Batch size is 0 or NaN. Please choose a non-zero fraction." ; let shuffledIndices = new Int32Array ( tf . util . createShuffledIndices ( loadTrainData . labels . shape [ 0 ] ) ) ; console . time ( "Training Time" ) ; return this . model . fit ( loadTrainData . images . gather ( shuffledIndices ) , loadTrainData . labels . gather ( shuffledIndices ) , { batchSize , epochs : this . epochs , validationSplit : 0.15 , callbacks : tf . node . tensorBoard ( "/tmp/tf_fit_logs" ) } ) ; }
Function to perform data training
Function to perform data training
/*callbacks: {
                    onBatchEnd: async (batch, logs) => {
                        //console.log("Loss: " + logs.loss.toFixed(5));
                    },
                    onTrainEnd: async logs => {
                        console.timeEnd("Training Time");
                    }
                }*/