Resolving an application classpath conflict
Closed this issue · 2 comments
i use scala write a LR model and start with stringindexer model, because i want use orgin data(including string feature and dpuble feature) to predict .
scala 2.11.8
spark 2.3.3
jmmp-spark 1.4.18
pmml-model 1.5.12
jpmml-evaluator-spark 1.2.2
List inputFields = model.getInputFields();
System.out.println(inputFields);
result:
[InputField{name=Sex, displayName=null, dataType=string, opType=categorical}, InputField{name=Pclass, displayName=null, dataType=double, opType=continuous}, InputField{name=Age, displayName=null, dataType=double, opType=continuous}, InputField{name=SibSp, displayName=null, dataType=double, opType=continuous}, InputField{name=Parch, displayName=null, dataType=double, opType=continuous}, InputField{name=Fare, displayName=null, dataType=double, opType=continuous}]
System.out.println("@@@@ "+rawValue);
FieldValue inputFieldValue = inputField.prepare(rawValue);
result:
@@@@ female
Exception in thread "main" java.lang.NoSuchMethodError: org.dmg.pmml.Value.getValue()Ljava/lang/String;
at org.jpmml.evaluator.InputFieldUtil.getStatus(InputFieldUtil.java:309)
at org.jpmml.evaluator.InputFieldUtil.getStatus(InputFieldUtil.java:269)
at org.jpmml.evaluator.InputFieldUtil.prepareScalarInputValue(InputFieldUtil.java:133)
at org.jpmml.evaluator.InputFieldUtil.prepareInputValue(InputFieldUtil.java:112)
Thanks in advance for helping.
Evaluator model = demo.loadPmml(path);
List<InputField> inputFields = model.getInputFields();
System.out.println(inputFields);
HashMap<String,Object> hm = new HashMap<>();
hm.put("Sex","female");
hm.put("Pclass",3.0);
hm.put("Age",15.0);
hm.put("SibSp",3.0);
hm.put("Parch",0.0);
hm.put("Fare",1.0);
demo.predict(model,hm);
pmml-model 1.5.12
jpmml-evaluator-spark 1.2.2
The Java/JVM is throwing an NoSuchMethodError
, because your application classpath contains library versions that are not compatible with one another.
In the current case, you should only include the JPMML-Evaluator-Spark
library.