Generic for computing loss and metrics on test data.
evaluate(object, ...)# S3 method for ggml_sequential_model
evaluate(object, x, y, batch_size = NULL, ...)
# S3 method for ggml_functional_model
evaluate(object, x, y, batch_size = NULL, ...)
A named list with loss and metric values.
A trained model object.
Additional arguments passed to ggml_evaluate.
Test data.
Test labels.
Batch size. NULL (default) uses 32, as in keras3.
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.