Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving an application classpath conflict #41

Closed
Berwin77 opened this issue Aug 26, 2021 · 2 comments
Closed

Resolving an application classpath conflict #41

Berwin77 opened this issue Aug 26, 2021 · 2 comments

Comments

@Berwin77
Copy link

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.

@Berwin77
Copy link
Author

Berwin77 commented Aug 26, 2021

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);

@vruusmann vruusmann transferred this issue from jpmml/jpmml-model Aug 26, 2021
@vruusmann
Copy link
Member

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.

@vruusmann vruusmann changed the title jmmp predict not support String feature? Resolving an application classpath conflict Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants