use of org.jpmml.evaluator.ModelEvaluatorFactory in project openscoring by openscoring.
the class ModelRegistry method load.
@SuppressWarnings(value = { "resource" })
public Model load(InputStream is) throws Exception {
CountingInputStream countingIs = new CountingInputStream(is);
HashingInputStream hashingIs = new HashingInputStream(Hashing.md5(), countingIs);
PMML pmml = unmarshal(hashingIs, this.validate);
this.visitorBattery.applyTo(pmml);
ModelEvaluatorFactory modelEvaluatorFactory = this.modelEvaluatorFactory;
Evaluator evaluator = modelEvaluatorFactory.newModelEvaluator(pmml);
evaluator.verify();
Model model = new Model(evaluator);
model.putProperty(Model.PROPERTY_FILE_SIZE, countingIs.getCount());
model.putProperty(Model.PROPERTY_FILE_MD5SUM, (hashingIs.hash()).toString());
return model;
}
Aggregations