| evaluate | R Documentation |
Generic for computing loss and metrics on test data.
evaluate(object, ...)
## S3 method for class 'ggml_sequential_model'
evaluate(object, x, y, batch_size = NULL, ...)
## S3 method for class 'ggml_functional_model'
evaluate(object, x, y, batch_size = NULL, ...)
object |
A trained model object. |
... |
Additional arguments passed to |
x |
Test data. |
y |
Test labels. |
batch_size |
Batch size. |
A named list with loss and metric values.
generics::evaluate declares its first argument as x, so S3
dispatch happens on whatever is bound to x. With the keras3 argument
order evaluate(model, x, y) that works positionally, but naming the
data explicitly – evaluate(model, x = x, y = y) – binds the *data*
to x, dispatches on it, and fails with "no applicable method".
Declaring the generic here with object as its first argument fixes
that and also resolves the S3 generic/method consistency warning from
R CMD check.
The trade-off: attaching both ggmlR and keras3 makes the two evaluate
generics mask one another, and the later-attached package wins. Qualify the
call (ggmlR::evaluate(...)) if both are loaded. compile() and
fit() are unaffected – generics declares those with
object first, so they are still re-exported from there.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.