liveBook · Manning

Deployment

As explained in Deep Learning with R, Third Edition

Deployment is the process of making a trained machine-learning model available in an operational environment for use.

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

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains export, inference optimization, serving options, environment choices, and monitoring without detailing infrastructure implementation.
Examples
Uses TensorFlow SavedModel and ONNX exports, REST serving, Posit Connect, and deployment to web, mobile, browser, or embedded environments.
What it assumes
Assumes a trained model with successful final test evaluation and teaches deployment choices after model development.
What you can do after
Operate/configure an exported model for inference through TensorFlow Serving, ONNX, Posit Connect, or another chosen environment.
How it connects
Connects deployment with test evaluation, inference, REST APIs, TensorFlow Serving, ONNX, model optimization, and production monitoring.

Also explained in

Compare how 23 books explain deployment →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.