![]() |
VOOZH | about |
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
Tensorflow.js tf.callbacks.earlyStopping() is a callback function used for stopping training when training data stop improving.
Syntax:
tf.callbacks.earlyStopping(args);
Parameters: This method accepts the following parameters.
Return Value: It returns an object (EarlyStopping).
Below are some examples of this function.
Example 1: In this example we will see how to use tf.callbacks.earlyStopping() function in fitDataset:
Output: The value you get is different because with training value its val_acc value changes.
The value of val_acc is :0.4375,0.375
Example 2: In this example, we will see how to use tf.callbacks.earlyStopping() with fit:
Output: The value of your executing code will be different because with training data value changes:
the value of val_acc is : 0.3333333432674408,0.3333333432674408
Reference: https://js.tensorflow.org/api/latest/#callbacks.earlyStopping