Scoring Outside the Box: Code Examples - C

After using JMP to create a model and generate scoring code for it in C, the next step is to compile it into an application so that it can be used to score new data.

Building

Compilation instructions depend on the target platform and operation system; the following examples were created for Microsoft Windows.

The simplest approach is to use static linking to create a monolithic application containing the model. Another option is to create a dynamic link library (DLL), which can be used by a dynamic model runner application designed to select a model to score the data at runtime. Both scenarios are illustrated by the example applications located in the source directory.

To compile the C scoring code generated by JMP you will need header (.h) files provided with your JMP install, located at the "JMP_INSTALL/Scoring/C" directory. The next image shows their typical location:

The example applications were developed in C++, using Microsoft Visual Studio. In order to build them in your environment you will need to adapt some of the Visual Studio properties so that they match the location of the source files in your system and the JMP installation directory:

Running

The tools directory contains:

Why two versions? Because when compiling a DLL or application we have to specify the target CPU architecture, x86 or x64. DLLs compiled for x86 (32 bits) have to be executed by a x86 application, and vice-versa.

Conclusion

Although these steps are more complex than what would be required when using an interpreted language like Python, a compiled model has important advantages from a deployment point of view. Chief among them is performance, but also ease of integration with automated data pipelines through linking (static or dynamic) as well as wrapping in command line applications as the one described here.