# Test custom models locally
URL: https://docs.datarobot.com/en/docs/api/code-first-tools/drum/custom-local-test.html

> Use the DataRobot Model Runner tool (DRUM) to test and verify a Python, R, or Java custom model locally, before you upload it to DataRobot.

# Test custom models locally

> [!NOTE] Availability information
> To access the DataRobot Model Runner tool, contact your DataRobot representative.

The DataRobot Model Runner is a tool that allows you to test Python, R, and Java custom models locally. The test verifies that a custom model can successfully run and make predictions before you [upload it to DataRobot](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-create-custom-model.html). However, this testing is only for development purposes. DataRobot recommends that you also test custom model you wish to deploy in the [Workshop](https://docs.datarobot.com/en/docs/workbench/nxt-registry/nxt-model-workshop/nxt-test-custom-model.html) after uploading it.

Before proceeding, reference the guidelines for [setting up a custom model or environment folder](https://docs.datarobot.com/en/docs/api/code-first-tools/drum/index.html).

> [!NOTE] Note
> The DataRobot Model Runner tool supports Python, R, and Java custom models.

Reference the [DRUM readme](https://github.com/datarobot/datarobot-user-models?tab=readme-ov-file#datarobot-user-models) for details about additional functionality, including:

- Autocompletion
- Custom hooks
- Performance tests
- Running models with a prediction server
- Running models inside a Docker container

### Model requirements

In addition to the required folder contents, DRUM requires the following for your serialized model:

- Regression models must return a single floating point per row of prediction data.
- Binary classification models must return two floating point values that sum to 1.0 per row of prediction data.
- The first value must be the positive class probability, and the second the negative class probability.
- There is a single pkl/pth/h5 file present.

## Run tests with the DataRobot CM Runner

Use the following commands to execute local tests for your custom model:

```
# List all possible arguments
drum --help
```

```
# Test a custom binary classification model
drum score -m ~/custom_model/ --input <input-dataset-filename.csv>  [--positive-class-label <labelname>] [--negative-class-label <labelname>] [--output <output-filename.csv>] [--verbose]

# Use --verbose for a more detailed output. Make batch predictions with a custom binary classification model. Optionally, specify an output file. Otherwise, predictions are returned to the command line.
```

```
# Example: Test a custom binary classification model
drum score -m ~/custom_model/ --input 10k.csv  --positive-class-label yes --negative-class-label no --output 10k-results.csv --verbose
```

```
# Test a custom regression model
drum score -m ~/custom_model/ --input <input-dataset-filename.csv> [--output <output-filename.csv>] [--verbose]

# Use --verbose for a more detailed output. Make batch predictions with a custom regression model. Optionally, specify an output file. Otherwise, predictions are returned to the command line.
```

```
# Example: Test a custom regression model
drum score -m ~/custom_model/ --input fast-iron.csv --verbose

# This is an example that does not include an output command, so the prediction results return in the command line.
```

---
