* 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 = {})
| 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. |
no outgoing calls