Comments (3)
What is the name/version of your PMML producer software? It is producing invalid results and should be replaced with something better.
The LogisticRegression
file appears to represent a binary logistic classification model. The target field of a classification model should have a categorical
operational type, and provide the list of target category names. So, the DataField
element for field Attribute8
should look something like this:
<DataField name="Attribute8" optype="categorical" dataType="string"/>
<Value value="0"/>
<Value value="1"/>
</DataField>
Currently, the JPMML-Evaluator is throwing an exception (on line 119 in RegressionModelEvaluator.java), because it doesn't make sense to have a target field with continuous
operational type.
Also, the ordering of two RegressionTable
elements seems wrong to me. The first RegressionTable
element should compute the probability of the event taking place (ie. targetCategory="1"
), and the second RegressionTable
element should be a constant (ie. targetCategory="0"
). You have it exactly backwards. For extended discussion, see the description of the RegressionModel
element (search for the phrase "Note that Binary logistic regression is a special case").
The LinearRegression
file looks better. Still, the RegressionTable
element should not specify the targetCategory
attribute, as it is only applicable to classification-type models.
from jpmml-evaluator.
Thank you so much for your prompt reply. I am working on Linear Regression Classification problem and my xml is this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PMML xmlns="http://www.dmg.org/PMML-4_2">
<DataDictionary numberOfFields="9">
<DataField name="Attribute0" optype="continuous" dataType="double"/>
<DataField name="Attribute1" optype="continuous" dataType="double"/>
<DataField name="Attribute2" optype="continuous" dataType="double"/>
<DataField name="Attribute3" optype="continuous" dataType="double"/>
<DataField name="Attribute4" optype="continuous" dataType="double"/>
<DataField name="Attribute5" optype="continuous" dataType="double"/>
<DataField name="Attribute6" optype="continuous" dataType="double"/>
<DataField name="Attribute7" optype="continuous" dataType="double"/>
<DataField name="Attribute8" optype="categorical" dataType="double">
<Value value="0.0"/>
<Value value="1.0"/>
</DataField>
</DataDictionary>
<RegressionModel functionName="classification" algorithmName="linearRegression">
<MiningSchema>
<MiningField name="Attribute0"/>
<MiningField name="Attribute1"/>
<MiningField name="Attribute2"/>
<MiningField name="Attribute3"/>
<MiningField name="Attribute4"/>
<MiningField name="Attribute5"/>
<MiningField name="Attribute6"/>
<MiningField name="Attribute7"/>
<MiningField name="Attribute8" usageType="target"/>
</MiningSchema>
<RegressionTable intercept="-8.397856251858588" targetCategory="0.0">
<NumericPredictor name="Attribute0" coefficient="0.1230185712966992"/>
<NumericPredictor name="Attribute1" coefficient="0.03514316177407176"/>
<NumericPredictor name="Attribute2" coefficient="-0.013282878621280676"/>
<NumericPredictor name="Attribute3" coefficient="6.631624570875322E-4"/>
<NumericPredictor name="Attribute4" coefficient="-0.0011962985482762522"/>
<NumericPredictor name="Attribute5" coefficient="0.08961636497438935"/>
<NumericPredictor name="Attribute6" coefficient="0.943894934066085"/>
<NumericPredictor name="Attribute7" coefficient="0.014842809237409734"/>
</RegressionTable>
</RegressionModel>
</PMML>
But it keeps complaining about Invalid Feature Exception. Here is my stack trace. Please guide me as to what is the problem.
org.jpmml.evaluator.InvalidFeatureException: DataField
at org.jpmml.evaluator.RegressionModelEvaluator.evaluateClassification(RegressionModelEvaluator.java:134)
at org.jpmml.evaluator.RegressionModelEvaluator.evaluate(RegressionModelEvaluator.java:69)
at org.jpmml.evaluator.ModelEvaluator.evaluate(ModelEvaluator.java:406)
at com.norkorm.blake.pmml.LinearRegressionClassificationPMMLTest.makePredictions(LinearRegressionClassificationPMMLTest.java:162)
at com.norkorm.blake.pmml.LinearRegressionClassificationPMMLTest.testLinearPMML(LinearRegressionClassificationPMMLTest.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
from jpmml-evaluator.
If you open file pmml-evaluator/src/main/java/org/jpmml/evaluator/RegressionModelEvaluator.java
and go to line 134, then you will be able to see the description of the "structural problem" that causes this InvalidFeatureException
to be thrown.
In this case, it's about mismatch between the number of target category levels (two - "0.0" and "1.0") and the number of RegressionTable
elements (one - "0.0"). You can solve this problem by adding an empty RegressionTable
element for the second category:
<RegressionTable targetCategory="1.0" intercept="0.0"/>
from jpmml-evaluator.
Related Issues (20)
- How to work with an association rules model (`AssociationModel` element)? HOT 8
- JPMML is enforcing the definition of target fields while the spec says it is optional HOT 6
- jpmml-evaluator does not handle null values when used in java? HOT 1
- Ability to run multiple JPMML-Evaluator versions in parallel (inside the same JVM) HOT 1
- NumberFormatException for evaluate "Random Survival Forest Model" generated by "SoftwareAG PMML Generator" HOT 3
- Compatibility with GraalVM HOT 12
- Not happy with XGBoost evaluation performance HOT 3
- How to load pre-transpiled PMML service provider JAR files? HOT 2
- Model verification fails for XGBoost models HOT 1
- No class def found for jakarta/xml/bind/JAXBContext HOT 3
- java.lang.IllegalArgumentException: Name cannot be empty HOT 1
- java.lang.NoClassDefFoundError: Could not initialize class org.jpmml.evaluator.FieldUtil HOT 4
- If the version 1.6.4 could work on java 8? HOT 1
- Field pmml(pred) is not defined. HOT 5
- DuplicatedFieldValueException after loading PMML in Java generated by Nyoka HOT 8
- 1.6.4 cannot run on java 8
- Exception: Required attribute `Segmentation@multipleModelMethod` is not defined HOT 3
- Updating Guava dependency to latest HOT 4
- why create jar file create error HOT 1
- LoadingModelEvaluatorBuilder not usable on Android due to "java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Image" HOT 2
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 jpmml-evaluator.