Deployment makes a trained machine-learning model available in an operational environment for productive use. It begins after the model clears final evaluation on the test set and continues through shipping and production monitoring. section 6.3 section 6.4
Production usually uses an exported inference model rather than the training-time model object. Exporting removes dependence on R or Python when necessary, while inference-focused optimization can improve speed and reduce memory use. section 6.3.2
Practical deployment choices include:
- Serve predictions through a REST API using TensorFlow Serving or ONNX, with model weights and the computation graph available outside the R program. section 6.3.2
- Export to an environment suited to the application, such as a web server, mobile app, browser, or embedded device. section 6.3.2 section 6.4
- Use a remote API when the consuming application has reliable internet access and does not require strict latency; otherwise, local deployment may be preferable. section 6.3.2
- Set stakeholder expectations, optimize the final model for inference, monitor production performance, and keep collecting data for the next model generation. section 6.4
library(keras3)
model |>
export_savedmodel("path/to/location", format = "tf_saved_model") #1
reloaded_artifact <- tensorflow::tf$saved_model$load("path/to/location") #2
predictions <- reloaded_artifact$serve(input_data)
Export a Keras model as a TensorFlow SavedModel, reload the serving artifact, and call it with input data to obtain predictions. section 6.3.2






















