MCPcopy
hub / github.com/tensorflow/tfjs / fit

Method fit

tfjs-layers/src/models.ts:867–877  ·  view source on GitHub ↗

* Trains the model for a fixed number of epochs (iterations on a dataset). * * ```js * const model = tf.sequential({ * layers: [tf.layers.dense({units: 1, inputShape: [10]})] * }); * model.compile({optimizer: 'sgd', loss: 'meanSquaredError'}); * const history = await model.fit

(
      x: Tensor|Tensor[]|{[inputName: string]: Tensor},
      y: Tensor|Tensor[]|{[inputName: string]: Tensor},
      args: ModelFitArgs = {})

Source from the content-addressed store, hash-verified

865 * @doc {heading: 'Models', subheading: 'Classes'}
866 */
867 override async fit(
868 x: Tensor|Tensor[]|{[inputName: string]: Tensor},
869 y: Tensor|Tensor[]|{[inputName: string]: Tensor},
870 args: ModelFitArgs = {}): Promise<History> {
871 if (!this.built) {
872 throw new RuntimeError(
873 'The model needs to be compiled before ' +
874 'being used.');
875 }
876 return this.model.fit(x, y, args);
877 }
878
879 /**
880 * Trains the model using a dataset object.

Callers 9

models_test.tsFile · 0.45
model_save_test.tsFile · 0.45
callbacks_test.tsFile · 0.45
trainModelRunnerFunction · 0.45
callbacks_test.tsFile · 0.45

Calls

no outgoing calls

Tested by 1