predict_proba: (Deprecated) Generates probability or class probability...

View source: R/model.R

predict_probaR Documentation

(Deprecated) Generates probability or class probability predictions for the input samples.


These functions were removed in Tensorflow version 2.6. See details for how to update your code:


predict_proba(object, x, batch_size = NULL, verbose = 0, steps = NULL)

predict_classes(object, x, batch_size = NULL, verbose = 0, steps = NULL)



Keras model object


Input data (vector, matrix, or array). You can also pass a tfdataset or a generator returning a list with (inputs, targets) or (inputs, targets, sample_weights).


Integer. If unspecified, it will default to 32.


Verbosity mode, 0, 1, 2, or "auto". "auto" defaults to 1 for for most cases and defaults to verbose=2 when used with ParameterServerStrategy or with interactive logging disabled.


Total number of steps (batches of samples) before declaring the evaluation round finished. The default NULL is equal to the number of samples in your dataset divided by the batch size.


How to update your code:

predict_proba(): use predict() directly.


  • If your model does multi-class classification: (e.g. if it uses a softmax last-layer activation).

     model %>% predict(x) %>% k_argmax()
  • if your model does binary classification (e.g. if it uses a sigmoid last-layer activation).

     model %>% predict(x) %>% `>`(0.5) %>% k_cast("int32")

The input samples are processed batch by batch.

See Also

Other model functions:,, evaluate_generator(),, fit_generator(), get_config(), get_layer(), keras_model_sequential(), keras_model(), multi_gpu_model(), pop_layer(),, predict_generator(), predict_on_batch(),, train_on_batch()

keras documentation built on Dec. 28, 2022, 2:20 a.m.