my pmml file link. generated by R-Tool
here is my java code..
PMML model = null;
File inputFilePath = new File("/home/equation/iris_rf.pmml");
try (InputStream is = new FileInputStream(inputFilePath)) {
model = org.jpmml.model.PMMLUtil.unmarshal(is);
} catch (Exception e) {
throw e;
}
// construct a tree predictor based on the PMML
ModelEvaluator<TreeModel> modelEvaluator = new TreeModelEvaluator(model);
System.out.println(modelEvaluator.getSummary());
exception ---
Exception in thread "main" org.jpmml.evaluator.InvalidFeatureException: PMML
at org.jpmml.evaluator.ModelEvaluator.selectModel(ModelEvaluator.java:528)
at org.jpmml.evaluator.tree.TreeModelEvaluator.<init>(TreeModelEvaluator.java:64)
at com.girnarsoft.Pmml.main(Pmml.java:24)
any idea? why getting this error ?
You must instantiate org.jpmml.evaluator.ModelEvaluator
subclass that matches the top-level Model element of your PMML file.
Currently, you're instantiating org.jpmml.evaluator.tree.TreeModelEvaluator
, which corresponds to the TreeModel
element. However, you should be instantiating org.jpmml.evaluator.mining.MiningModelEvaluator
instead, as the top-level Model element in your PMML file is the MiningModel
element.
In general, you should construct ModelEvaluator
instances using the ModelEvaluatorFactory#newModelEvaluator(PMML)
factory method.