function earlyStopping(args) {
	  return new EarlyStopping(args);
	}
Factory function for a Callback that stops training when a monitored
quantity has stopped improving.

Early stopping is a type of regularization, and protects model against
overfitting.

The following example based on fake data illustrates how this callback
can be used during `tf.LayersModel.fit()`:

```js
const model = tf.sequential();
model.add(tf.layers.dense({
  units: 3,
  activation: 'softmax',
  kernelInitializer: 'ones',
  inputShape: [2]
}));
const xs = tf.tensor2d([1, 2, 3, 4], [2, 2]);
const ys = tf.tensor2d([[1, 0, 0], [0, 1, 0]], [2, 3]);
const xsVal = tf.tensor2d([4, 3, 2, 1], [2, 2]);
const ysVal = tf.tensor2d([[0, 0, 1], [0, 1, 0]], [2, 3]);
model.compile(
    {loss: 'categoricalCrossentropy', optimizer: 'sgd', metrics: ['acc']});

// Without the EarlyStopping callback, the val_acc value would be:
//   0.5, 0.5, 0.5, 0.5, ...
// With val_acc being monitored, training should stop after the 2nd epoch.
const history = await model.fit(xs, ys, {
  epochs: 10,
  validationData: [xsVal, ysVal],
  callbacks: tf.callbacks.earlyStopping({monitor: 'val_acc'})
});

// Expect to see a length-2 array.
console.log(history.history.val_acc);
```

@doc {
  heading: 'Callbacks',
  namespace: 'callbacks'
}