Driverless AI MOJO Scoring Pipeline - C++ Runtime with Python and R Wrappers

The C++ Scoring Pipeline is provided as R and Python packages for the protobuf-based MOJO2 protocol. The packages are self-contained, so no additional software is required. Use your preferred method once the MOJO Scoring Pipeline has been built.

Notes:

  • These scoring pipelines are currently not available for RuleFit models.

  • The Download MOJO Scoring Pipeline button appears as Build MOJO Scoring Pipeline if the MOJO Scoring Pipeline is disabled.

  • You can have Driverless AI attempt to reduce the size of the MOJO scoring pipeline when the experiment is being built by enabling the Reduce MOJO Size expert setting also see.

Downloading the Scoring Pipeline Runtimes

The R and Python packages can be downloaded from within the Driverless AI application. To do this, click Resources, then click MOJO2 R Runtime and MOJO2 Py Runtime from the drop-down menu. In the pop-up menu that appears, click the button that corresponds to the OS you are using. Choose either Linux or IBM PowerPC.

Examples

The following examples show how to use the R and Python APIs of the C++ MOJO runtime.

Prerequisites

  • Linux OS (x86 or PPC)

  • Driverless AI License (either file or environment variable)

  • Rcpp (>=1.0.0)

  • data.table

Running the MOJO2 R Runtime

# Install the R MOJO runtime using one of the methods below

# Install the R MOJO runtime on PPC Linux
install.packages("./daimojo_2.5.15_ppc64le-linux.tar.gz")

# Install the R MOJO runtime on x86 Linux
install.packages("./daimojo_2.5.15_x86_64-linux.tar.gz")

# Load the MOJO
library(daimojo)
m <- load.mojo("./mojo-pipeline/pipeline.mojo")

# retrieve the creation time of the MOJO
create.time(m)
## [1] "2019-11-18 22:00:24 UTC"

# retrieve the UUID of the experiment
uuid(m)
## [1] "65875c15-943a-4bc0-a162-b8984fe8e50d"

# Load data and make predictions
col_class <- setNames(feature.types(m), feature.names(m))  # column names and types

library(data.table)
d <- fread("./mojo-pipeline/example.csv", colClasses=col_class, header=TRUE, sep=",")

predict(m, d)
##       label.B    label.M
## 1  0.08287659 0.91712341
## 2  0.77655075 0.22344925
## 3  0.58438434 0.41561566
## 4  0.10570505 0.89429495
## 5  0.01685609 0.98314391
## 6  0.23656610 0.76343390
## 7  0.17410333 0.82589667
## 8  0.10157948 0.89842052
## 9  0.13546191 0.86453809
## 10 0.94778244 0.05221756