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
lucy_luo_conoco
Level III

question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

I am using JMPpro 15 with Boosted Tree model to predict a target variable. when I am trying to use formula depot to generate Python Code for applying in python environment, it pops up JMP Alert Formula evaluation requires implementation of operator "IfMZ"   and the python code is not working due to it can't recognize it. 

for example, in the python code exported from JMP

_temp_5 = placeholder_IfMZ((indata[u"A"] == u"<100%"), 0.176288660753027, (indata[u"A"] == u"0" or indata[u"A"] == u"~100%"), 0.326534073883455, 0)
_temp_4 = _temp_5

 

JMP/Python experts, do you knows how to fix it? thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
nascif_jmp
Level VI

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

Hi @ih, thanks for pointing @lucy_luo_conoco in the right direction.

Good to hear from you again, @lucy_luo_conoco. Yes, our goal is to cover as much as possible of the JSL operators when generating scoring code, but given the large number of operators in the language sometimes we rely on placeholders. We understand it puts a burden on our customers and we are sorry for that, but we believe it is a better alternative to not generating any code at all. It also allows us to get feedback on which operators we need to implement next.

In this particular case, I am happy to report that we have already implemented support for ifMZ in JMP 15.2. If you're able to upgrade, you will find that the scoring code for your boosted tree should work out of the box.

If that is not possible, please note that you wouldn't have to implement it for every time the placeholder is used in the scoring code. You would only need to provide the definition for the placeholder function once.

 

View solution in original post

5 REPLIES 5
ih
Super User (Alumni) ih
Super User (Alumni)

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

I believe you need to write a custom python function that replaces missing values as zero before evaluating the if statement, then use that function in placeholder. Check out the Scripting Index for a description of what IfMZ does.

lucy_luo_conoco
Level III

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

Thanks for reply. I thought formula depot can automatically generate Python code without modifying. this is not convenient at all. because I have so many different conditions/variables. 

_temp_40 = placeholder_IfMZ((indata[u"B"] == u"U2" or indata[u"B"] == u"MULTI" or indata[u"B"] == u"L1"), 0.241910570257302, (indata[u"TB"] == u"L2"), -0.216517363734128, 0)

_temp_61 = placeholder_IfMZ((indata[u"C"] == u"U2"), -0.117955642135196, (indata[u"C"] == u"(Empty)"), -1.58336331994262, 0)

nascif_jmp
Level VI

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

Hi @ih, thanks for pointing @lucy_luo_conoco in the right direction.

Good to hear from you again, @lucy_luo_conoco. Yes, our goal is to cover as much as possible of the JSL operators when generating scoring code, but given the large number of operators in the language sometimes we rely on placeholders. We understand it puts a burden on our customers and we are sorry for that, but we believe it is a better alternative to not generating any code at all. It also allows us to get feedback on which operators we need to implement next.

In this particular case, I am happy to report that we have already implemented support for ifMZ in JMP 15.2. If you're able to upgrade, you will find that the scoring code for your boosted tree should work out of the box.

If that is not possible, please note that you wouldn't have to implement it for every time the placeholder is used in the scoring code. You would only need to provide the definition for the placeholder function once.

 

lucy_luo_conoco
Level III

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

Nascif,

 

Thanks again for your help and glad to see jmp_score.py is updated   Just updated my JMP 15.2 and will try again. 

lucy_luo_conoco
Level III

Re: question about formula depot, Generate Python Code with error "Formula evaluation requires implementation of operator "IfMZ"

After updated JMP 15.2, it works great!

jmp_score.py add mz function 

got support and  help from Nascif again when I run into additional error. 

just make sure to close/reopen Spyde/Jupter Notebook, and remove pyc files when you use updated jmp_score.py for mz function