Train, evaluate or predict a model


This page shows how to train, evaluate or predict a model using the Keras-Style API.

You may refer to the User Guide page to see how to define a model in Python or Scala correspondingly.

You may refer to Layers section to find all the available layers.

After defining a model with the Keras-Style API, you can call the following methods on the model:


Compile

Configure the learning process. Must be called before fit or evaluate.

Scala:

compile(optimizer, loss, metrics = null)

Python

compile(optimizer, loss, metrics=None)

Parameters:


Fit

Train a model for a fixed number of epochs on a dataset. Need to first compile the model beforehand.

Scala:

fit(x, nbEpoch = 10, validationData = null)

Python

fit(x, y=None, batch_size=32, nb_epoch=10, validation_data=None, distributed=True)

Parameters:

Remark


Evaluate

Evaluate a model on a given dataset using the metrics specified when you compile the model.

Scala:

evaluate(x)

Python

evaluate(x, y=None, batch_size=32)

Parameters:

Remark


Predict

Use a model to do prediction.

Scala:

predict(x)

Python

predict(x, distributed=True)

Parameters:

Remark