Skip to content

On-premise users: click in-app to access the full platform documentation for your version of DataRobot.

Examples directory

The examples directory in the MLOps agent tarball contains both sample code (snippets for manual inspection) and example code (self-contained examples that you can run) in Python and Java. Navigate to the subdirectory for the language you wish to use and reference the respective README for further instruction.

The examples directory includes model configuration, data, and scripts used to create deployments and run the examples, using Python to create the model package and deployment programmatically. Therefore, you must install the Python version of the MLOps library (described below). These examples also use the MLOps Command Line Interface (mlops-cli) to set up deployments and perform deployment actions. You must provide the MLOPS_SERVICE_URL and MLOPS_API_TOKEN environment variables to use the mlops-cli. In addition, most examples use the mlops-cli to upload monitoring data for faster setup; however, while the mlops-cli tool is suitable for simple use cases, you should use the agent for production scenarios.

Run code examples with Python

To run the Python code examples, you must install the dependencies used by the examples:

pip install -r examples/python/requirements.txt

See the README file in each example directory for further example-specific configuration requirements. In general, to run an example:

  1. Initialize the model package and deployment:

  2. Generate predictions and report statistics to DataRobot:

  3. Verify that metrics were sent successfully:

  4. Delete resources created in the example:


Updated May 24, 2023