Choose Language Hide Translation Bar
Highlighted

Re: error when run python code(created through JMP formula depot )

Hi @eranraz1,

 

I found two issues with the code you posted:

1) You provided a string as an input value for DESIGN_LAYERS. The scoring code expects a float, as stated in the getInputMetadata() method; the value should not be quoted.

indata_aa =  {'DESIGN_LAYERS': '3','EXISTS_LASER_DRILL' : 'YES' } 

should be instead:

indata_aa =  {'DESIGN_LAYERS': 3,'EXISTS_LASER_DRILL' : 'YES' } 

2) The return line at the end of the scoring method is missing an subscription so that the value is added to a dictionary element, not to the (output) dictionary itself. If this is the original generated code, it is a bug. Maybe it is a change introduced by mistake while creating the test script.

 outdata = 358.593374276362 + 26.8517927560789 * indata[u"DESIGN_LAYERS"] + _temp_0

should be

 outdata[u"Add"] = 358.593374276362 + 26.8517927560789 * indata[u"DESIGN_LAYERS"] + _temp_0

With these changes, (and after adding a Numpy import statement) the script works and returns a result:

***************************
569.3520768491067
[Finished in 0.3s]

See attached for the complete, updated script.

PS: Next time, it would be better to open a new discussion and refer back to this 2-year old post for context.

 

Highlighted
eranraz1
Level I

Re: error when run python code(created through JMP formula depot )

Thank you very much for the quick and detailed response ,

it's working great now

thanks

Eran

Highlighted
lucy_luo_conoco
Level III

Re: error when run python code(created through JMP formula depot )

Nascif, https://community.jmp.com/t5/Discovery-Summit-2016/Scoring-Outside-the-Box/ta-p/22381 the example in this presentation really help me a lot. Great presentation and thank you so much for sharing the example and code.
Highlighted

Re: error when run python code(created through JMP formula depot )

So glad it helped, Lucy!
Article Labels

    There are no labels assigned to this post.