jpmml/jpmml-evaluator

NumberFormatException for evaluate "Random Survival Forest Model" generated by "SoftwareAG PMML Generator"

jinlong-hao opened this issue · 3 comments

I have trained a random survival forest model with R, and transfer to model to pmml with 'r-pmml@SoftwareAG'.

the pmml can be loaded with no error, but when used to infer, I got numberformat exception as follow:


java.lang.NumberFormatException: For input string: "HazardFunction"

	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
	at java.base/java.lang.Double.parseDouble(Double.java:543)
	at org.jpmml.evaluator.TypeUtil.parseDouble(TypeUtil.java:259)
	at org.jpmml.evaluator.TypeUtil.parse(TypeUtil.java:86)
	at org.jpmml.evaluator.TypeUtil.parseOrCast(TypeUtil.java:66)
	at org.jpmml.evaluator.tree.SimpleTreeModelEvaluator.evaluateAny(SimpleTreeModelEvaluator.java:94)
	at org.jpmml.evaluator.tree.SimpleTreeModelEvaluator.evaluateRegression(SimpleTreeModelEvaluator.java:77)
	at org.jpmml.evaluator.ModelEvaluator.evaluateInternal(ModelEvaluator.java:443)
	at org.jpmml.evaluator.mining.MiningModelEvaluator.evaluateSegmentation(MiningModelEvaluator.java:595)
	at org.jpmml.evaluator.mining.MiningModelEvaluator.evaluateRegression(MiningModelEvaluator.java:231)
	at org.jpmml.evaluator.ModelEvaluator.evaluateInternal(ModelEvaluator.java:443)
	at org.jpmml.evaluator.mining.MiningModelEvaluator.evaluateInternal(MiningModelEvaluator.java:224)
	at org.jpmml.evaluator.ModelEvaluator.evaluate(ModelEvaluator.java:300)

I found that there are many Node with score='HazardFunction' as below in the pmml file:

                  <Node score="HazardFunction" id="12">
                   <Extension>
                    <Array n="150" type="double">0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</Array>
                   </Extension>
                   <SimplePredicate field="c_sof_v2" operator="lessOrEqual" value="1.5"/>
                  </Node>

maybe, this is the problem of the exception, but i'm not sure about it.

I tried jpmml-evalutor from 1.5.9 to 1.6.4, and got the same exception

java.lang.NumberFormatException: For input string: "HazardFunction"

What is the numeric value of a "HazardFunction" string in your opinion?

I have trained a random survival forest model with R, and transfer to model to pmml with 'r-pmml@SoftwareAG'.

See the R source code of the corresponding PMML export function.

It is some SoftwareAG-specific hack there, it is not a valid/canonical PMML markup.

Resolution - won't fix - the JPMML-Evaluator software project is not interested in supporting legacy 3rd-party extensions.

It is possible that the JPMML family of libraries (both on the conversion and evaluation sides) will design and implement proper support for survival models.