Deployment to production is concerned with meeting scalability goals, which can be not just about data size but also about the number of customers for the scoring results. For a large and diverse audience, nothing beats the convenience of a web page - and this is where JMP's ability to generate JavaScript scoring code can help.
This directory has source code for an interactive rich-client web application that shows how to use JMP-generated JavaScript scoring code to score input data directly in the browser. We used the famous Iris data set in our example, building a tool that would allow a field botanist to classify (using the scoring code generated from a JMP Bootstrap Forest model) newly found flower specimens as one of the three known Iris species.
The web application user interface was built with Bootstrap, allowing it to be responsive and adapt to desktops and mobile browsers.
JMP generates JavaScript scoring code that follows the CommonJS module format. Therefore, the final web application has to be assembled with a module bundler tool like Browserify. Browserify is a Node.js application, installed via the npm package manager.
At build time, the module bundler will look the application dependencies and combine them in a single JavaScript file. The simplest way to satisfy this requirement is to copy both the JMP-generated JavaScript scoring code and the jmp_score.js support file provided with the JMP install to the directory that contains the application main module. For this example that location is .js.
Once the module bundler tool is installed and the JavaScript code is place on the correct place, building the app is as simple as calling:
browserify .\js\app.js -o .dist\bundle.jsOr calling the provided build.cmd script.
In the example application all processing happens in the browser, you can test it by simply pointing the browser to the index.html file in the directory it was copied to. If you copied the code examples to C:\JMPScoringDemos, that location would be:
file:///C:/JMPScoringDemos/JavaScript/WebApp/index.htmlIf you have Python installed, you can use the provided run.cmd to start a simple web server for a more realistic test. Launch it from the JavaScript/WebApp directory and then point your browser to:
http://localhost:9003
Web-based scoring can be used to create tools for a variety of scenarios that require on-the-spot scoring, from a real-estate agent assessing the potential market value of a house to a factory inspector evaluating the probability of failure of a machine. JavaScript opens the doors to other deployment scenarios as well, including server-based scoring using Node.js applications. You can even run these applications from the cloud, by deploying them to services like AWS Lambda service or Heroku.