Closed vruusmann closed 2 years ago
Quote:
In brief, you are using a binary classification model, which probably specifies RegressionModel@normalizationMethod="softmax"?
Exactly, I am using softmax:
<Segment id="2">
<True/>
<RegressionModel functionName="classification" normalizationMethod="softmax">
<MiningSchema>
<MiningField name="_target" usageType="target"/>
<MiningField name="xgbValue"/>
</MiningSchema>
<Output>
<OutputField dataType="double" feature="probability" name="probability_0" optype="continuous" value="0"/>
<OutputField dataType="double" feature="probability" name="probability_1" optype="continuous" value="1"/>
</Output>
<RegressionTable intercept="0.0" targetCategory="0">
<NumericPredictor coefficient="-1.0" name="xgbValue"/>
</RegressionTable>
<RegressionTable intercept="0.0" targetCategory="1"/>
</RegressionModel>
</Segment>
Thank you for pointing out the source. I modified the code located in src/main/java/org/jpmml/translator/regression/RegressionModelTranslator.java
line 194-196 to:
if(regressionTables.size() == 2 && !normalizationMethod.equals(RegressionModel.NormalizationMethod.SOFTMAX)){
valueMapBuilder.staticUpdate(RegressionModelUtil.class, "computeBinomialProbabilities", normalizationMethod);
}
And transpiled it again. It works!
The PMML document in question appears to be problematic. Specifically, the regression normalization method should be logit
(not softmax
) there. Also, since this is an XGBoost model, then all numeric data types should be float
(not double
).
Which software was used for producing it? It doesn't look to be the JPMML-XGBoost library, because it would be generating the following PMML markup instead:
<Segment id="2">
<True/>
<RegressionModel functionName="regression" normalizationMethod="logit" x-mathContext="float">
<MiningSchema>
<MiningField name="_target" usageType="target"/>
<MiningField name="xgbValue"/>
</MiningSchema>
<RegressionTable intercept="0.0">
<NumericPredictor name="xgbValue" coefficient="1.0"/>
</RegressionTable>
</RegressionModel>
</Segment>
Closing as "won't fix" - the JPMML-Transpiler library is not in the business of analyzing and correcting invalid PMML documents.
Please use a proper PMML producer software.
Extracted from https://github.com/jpmml/jpmml-transpiler/issues/13#issuecomment-856737434
Quote: Thanks for your help! I manage to transpile a XGBoost Model by following your instruction.
But I am getting this error when doing evaluation
Which is from this line of code
Map<FieldName, ?> results = evaluator.evaluate(arguments);
I am doing just fine for the same evaluation code when using the untranspiled .pmml model. Could you please help?