cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
frankderuyck
Level VI

Transfer jmp model script to python?

Our team created a neural and ARMA model in JMP and now a customer wants to evauate these models in Python. Can anyone help or give advice how to transfer the jmp model scripts to python? 

1 ACCEPTED SOLUTION

Accepted Solutions
nascif_jmp
Level VI

Re: Transfer jmp model script to python?

I am sorry about the lack of support for the deployment of our ARIMA models being a bottleneck for your project. This would make a good entry in the JMP Wish List.

 

Regarding the Python code generation for Neural Networks models: JMP Pro 14.2 added support for mapping JSL linear algebra operators to NumPy, resulting in much smaller and faster scoring code. Unfortunately, the default publishing operation for Neural Networks doesn't take advantage of that feature, but you can still access it by taking the following steps:

1) Fit your Neural Network;

2) From the model LRT, instead of using "Publish Prediction Formula" - which would push the model directly to the Formula Depot - use "Save Fast Formulas". This will add a new Formula column to your data table named

"Predicted <VARIABLE NAME>".

It is the same basic model but it uses matrix multiplications in its calculations.

3) Back to the main menu, select Analyze > Predictive Modelling > Formula Depot

4) From the Formula Depot LRT, select the first option, "Add Formula from Column". Select the new formula column if necessary (it will be selected automatically if it is the only one available). This should add a new entry to the Formula Depot with the name 

"Neural - <VARIABLE NAME>".

5) From the LRT of the new entry, select "Generate Python code"

 

View solution in original post

7 REPLIES 7
Jeff_Perkinson
Community Manager Community Manager

Re: Transfer jmp model script to python?

The Formula Depot in JMP Pro will generate Python code from JMP models.

-Jeff
frankderuyck
Level VI

Re: Transfer jmp model script to python?

Unfortunately I don't have jmp pro version, any possibility with the regular 14.1 software?

Craige_Hales
Super User

Re: Transfer jmp model script to python?

If you try to make your own, you might find the expression manipulation functions helpful for writing JSL that can study the JSL formula:

 

https://community.jmp.com/t5/Uncharted/Introspection/ba-p/28930

 

I just took a quick look at JMP's formula depot code that writes Python statements and decided there is more to it than I first imagined. @nascif_jmp 

Craige
nascif_jmp
Level VI

Re: Transfer jmp model script to python?

I would not advise using JSL introspection to manually convert these models to Python. Neural networks use primitives that you could in theory map to the corresponding Python operations (which is what the Formula Depot scoring code generation does behind the scenes) but they get very large and complex rather quickly, so if you make a mistake in your code it would be difficult to find where. Better to rely on JMP to make the conversion for you, though as Jeff pointed out, this is indeed a JMP Pro only feature.

 

ARIMA is more problematic as the generated model is not based in JSL primitives; there is nothing that can be mapped to Python operators. So even with a JMP Pro license you would not be able to the Formula Depot to generate Python code for it.

 

Here is more information and examples on the JMP scoring code generation capability:

https://community.jmp.com/t5/Discovery-Summit-2016/Scoring-Outside-the-Box/ta-p/22381

https://community.jmp.com/t5/Discovery-Summit-2017/Sharing-the-Ultimate-Boon-A-Journey-From-Modeling...

frankderuyck
Level VI

Re: Transfer jmp model script to python?

Thanks everyone for useful inputs. I will try to consult a JMP pro version and try to convert neural model profile script to python. Pity that ARIMA model script transfer appears to be difficult; according to the very interesting presentation on transfer functions during last discovery summit in Copenhagen I modeled the neural time series model residuals which wer not white noise, with an ARMA model with significant improvement of R² > 99%! I am now convinced that for time series X-ARIMA & transfer fuctions indeed is a powerful tool. These hybrid/combined models however are quite complex and a smooth transfer from JMP scripts to process software of end users/customers is a bottleneck in the project implementation stage. KInd regards, Frank

nascif_jmp
Level VI

Re: Transfer jmp model script to python?

I am sorry about the lack of support for the deployment of our ARIMA models being a bottleneck for your project. This would make a good entry in the JMP Wish List.

 

Regarding the Python code generation for Neural Networks models: JMP Pro 14.2 added support for mapping JSL linear algebra operators to NumPy, resulting in much smaller and faster scoring code. Unfortunately, the default publishing operation for Neural Networks doesn't take advantage of that feature, but you can still access it by taking the following steps:

1) Fit your Neural Network;

2) From the model LRT, instead of using "Publish Prediction Formula" - which would push the model directly to the Formula Depot - use "Save Fast Formulas". This will add a new Formula column to your data table named

"Predicted <VARIABLE NAME>".

It is the same basic model but it uses matrix multiplications in its calculations.

3) Back to the main menu, select Analyze > Predictive Modelling > Formula Depot

4) From the Formula Depot LRT, select the first option, "Add Formula from Column". Select the new formula column if necessary (it will be selected automatically if it is the only one available). This should add a new entry to the Formula Depot with the name 

"Neural - <VARIABLE NAME>".

5) From the LRT of the new entry, select "Generate Python code"

 

frankderuyck
Level VI

Re: Transfer jmp model script to python?

Thanks for this nice stepwise procedure for the neural part, I will surely use! Now 'll try to find a solution for ARIMA script transfer to eleminate time effects from residuals.. any help is welcome.