Comments (7)
As the exception shows, the failing construct is the Apply element on lines 21 -- 24:
<Apply function="equal">
<FieldRef field="raw_result"/>
<Constant dataType="string">noRuleFound</Constant>
</Apply>
According to the PMML specification, the "equal" built-in function takes two arguments, which have to be both non-null. In your case, one (or both) of the arguments is null.
Most likely, the missing argument is <FieldRef field="raw_result">
, which references the prediction of the rule set model. This model is very naive, and it's easy to see that it will return a null prediction every time when the value of the value
input field is something other than 0
.
In conclusion, the scoring will succeed if you pass value=0
as input, and fail otherwise. The Openscoring REST service is working properly.
from openscoring.
Given that I have provided a default score, shouldn't the raw_result field (which is the predicted field) never be null ?
from openscoring.
The contents of the "result" output field, expressed as Java code:
if(raw_result.equals("noRuleFound")){
return default_value;
} else {
return raw_result;
}
It can be seen that the "if" condition has to execute successfully (and produce a true
value) before the default_value
could be selected. You have a situation where the "if" condition fails (by throwing a NullPointerException
).
from openscoring.
As a workaround, you can check the "missingness" state of the raw_result
field:
<Apply function="if">
<Apply function="or">
<Apply function="isMissing">
<FieldRef field="raw_result"/>
</Apply>
<Apply function="equal">
<FieldRef field="raw_result"/>
<Constant>noRuleFound</Constant>
</Apply>
</Apply>
</Apply>
from openscoring.
Thanks for the help !
I gave the two workarounds a try but they didn't actually solve my issue unfortunately.
The issue I have is that the code:
- Will run on machine 1 but not machine 2 if I use:
<OutputField name="ruleId" optype="continuous" dataType="double" feature="entityId"/>
<OutputField name="result" feature = "transformedValue">
<Apply function="if">
<Apply function="equal">
<FieldRef field="raw_result"/>
<Constant dataType="string">noRuleFound</Constant>
</Apply>
<FieldRef field="default_value"/>
<FieldRef field="raw_result"/>
</Apply>
</OutputField>
</Output>
- Will run on machine 2 but not machine 1 if I use:
<OutputField name="raw_result" optype="categorical" dataType="string" feature="predictedValue"/>
<OutputField name="ruleId" optype="continuous" dataType="double" feature="entityId"/>
<OutputField name="result" feature = "transformedValue">
<Apply function="if">
<Apply function="equal">
<FieldRef field="raw_result"/>
<Constant dataType="string">noRuleFound</Constant>
</Apply>
<FieldRef field="default_value"/>
<FieldRef field="raw_result"/>
</Apply>
</OutputField>
</Output>
Both machines use the same version of openscoring.
from openscoring.
Both machines use the same version of openscoring.
Are you absolutely positively sure about that?
The difference between two code examples is this:
<OutputField name="raw_result" optype="categorical" dataType="string" feature="predictedValue"/>
Newer versions of openscoring (1.3.X) will fail if the prediction hasn't been imported into output scope using a specialized output field (<OutputField feature="predictedValue"/>
), whereas older version (1.2.X) silently work around it.
Therefore, it must be the case that you use older version on machine 1, and newer version on machine 2. Whatever the case, please upgrade to the latest version of openscoring on both machines to remove all doubt.
from openscoring.
Thanks, this must be the reason. I will investigate tomorrow morning.
Thanks again for all the support !
from openscoring.
Related Issues (20)
- Excess use of memory by pmml.gz files HOT 1
- Openscoring war deployment on Tomcat- admin role authorization HOT 2
- get the predictions results HOT 1
- [Question] Default folder for loading models? HOT 1
- tensorflow serving support HOT 2
- Client side throw an exception that java.lang.IllegalStateException: InjectionManagerFactory not found. HOT 2
- .pmml not reconize on upload
- Is there a configuration for enabling/disabling REST endpoints HOT 1
- Error: SEVERE: Failed to evaluate java.lang.NumberFormatException: For input string: "X" HOT 2
- feature request: add deploy method - pip/docker HOT 2
- How to enable CORS for the Server HOT 1
- the lastest jar version 2.0 "xgbValue" is not defined HOT 1
- Missing field when trying to score lightgbm model HOT 9
- IllegalArgumentException: Attribute 'GradientBoostingClassifier.loss_' has an unsupported value (Python class BinomialDeviance) HOT 1
- Service should log information about exceptional conditions before raising an exception HOT 6
- "message" : "Attribute with value RegressionTable@targetCategory=1 is not valid" HOT 4
- How to define the model.version? HOT 1
- openscoring-docker -- PMML 4.4 not supported HOT 1
- Missing derived field declaration HOT 2
- Secured requests HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openscoring.