private void run() throws Exception { Learner learner; ByteOrder byteOrder = ByteOrderUtil.forValue(this.byteOrder); try(InputStream is = new FileInputStream(this.modelInput)){ learner = XGBoostUtil.loadLearner(is, byteOrder, this.charset); } FeatureMap featureMap; try(InputStream is = new FileInputStream(this.fmapInput)){ featureMap = XGBoostUtil.loadFeatureMap(is); } if(this.missingValue != null){ featureMap.addMissingValue(this.missingValue); } Map<String, Object> options = new LinkedHashMap<>(); options.put(HasXGBoostOptions.OPTION_COMPACT, this.compact); options.put(HasXGBoostOptions.OPTION_NTREE_LIMIT, this.ntreeLimit); PMML pmml = learner.encodePMML(this.targetName != null ? FieldName.create(this.targetName) : null, this.targetCategories, featureMap, options); try(OutputStream os = new FileOutputStream(this.pmmlOutput)){ MetroJAXBUtil.marshalPMML(pmml, os); } } }
private void run() throws Exception { Learner learner; ByteOrder byteOrder = ByteOrderUtil.forValue(this.byteOrder); try(InputStream is = new FileInputStream(this.modelInput)){ learner = XGBoostUtil.loadLearner(is, byteOrder, this.charset); } FeatureMap featureMap; try(InputStream is = new FileInputStream(this.fmapInput)){ featureMap = XGBoostUtil.loadFeatureMap(is); } if(this.missingValue != null){ featureMap.addMissingValue(this.missingValue); } Map<String, Object> options = new LinkedHashMap<>(); options.put(HasXGBoostOptions.OPTION_COMPACT, this.compact); options.put(HasXGBoostOptions.OPTION_NTREE_LIMIT, this.ntreeLimit); PMML pmml = learner.encodePMML(this.targetName != null ? FieldName.create(this.targetName) : null, this.targetCategories, featureMap, options); try(OutputStream os = new FileOutputStream(this.pmmlOutput)){ MetroJAXBUtil.marshalPMML(pmml, os); } } }