当前位置: 首页>>代码示例>>Java>>正文


Java ImportFilter.apply方法代码示例

本文整理汇总了Java中org.jpmml.model.ImportFilter.apply方法的典型用法代码示例。如果您正苦于以下问题:Java ImportFilter.apply方法的具体用法?Java ImportFilter.apply怎么用?Java ImportFilter.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jpmml.model.ImportFilter的用法示例。


在下文中一共展示了ImportFilter.apply方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
@Override
public void init(ProcessContext processContext) throws Exception {
    //load model and marshal it into pmml version  > 4.0
    log.info("Loading .pmml model");
    try (InputStream is = url.openStream()) {
        Source transformedSource = ImportFilter.apply(new InputSource(is));
        pmml = JAXBUtil.unmarshalPMML(transformedSource);
    } catch (SAXException ex) {
        log.error("Could not load model from file provided at" + url);
    }
    //build a modelevaluator from the loaded pmml file
    ModelEvaluatorFactory modelEvaluatorFactory = ModelEvaluatorFactory.newInstance();
    modelEvaluator = modelEvaluatorFactory.newModelEvaluator(pmml);


    log.info("Loaded model requires the following fields: " + modelEvaluator.getActiveFields().toString());

    log.info("Loaded model has targets: " + modelEvaluator.getTargetFields().toString());
    if (modelEvaluator.getTargetFields().size() > 1) {
        log.error("Only models with one target variable are supported for now");
    }

    targetName = modelEvaluator.getTargetFieldName();
    activeFields = modelEvaluator.getActiveFields();
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:26,代码来源:ApplyModel.java

示例2: transform

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
private void transform(File pmmlFile, File serFile, List<Class<? extends Visitor>> visitorClazzes) throws Exception {
	PMML pmml;

	try(InputStream is = new FileInputStream(pmmlFile)){
		Source source = ImportFilter.apply(new InputSource(is));

		pmml = JAXBUtil.unmarshalPMML(source);
	}

	for(Class<? extends Visitor> visitorClazz : visitorClazzes){
		Visitor visitor = visitorClazz.newInstance();

		visitor.applyTo(pmml);
	}

	try(OutputStream os = new FileOutputStream(serFile)){
		SerializationUtil.serializePMML(pmml, os);
	}
}
 
开发者ID:jpmml,项目名称:jpmml-model,代码行数:20,代码来源:SerMojo.java

示例3: createEvaluator

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
static
public Evaluator createEvaluator(InputStream is) throws SAXException, JAXBException {
	Source source = ImportFilter.apply(new InputSource(is));

	PMML pmml = JAXBUtil.unmarshalPMML(source);

	// If the SAX Locator information is available, then transform it to java.io.Serializable representation
	LocatorTransformer locatorTransformer = new LocatorTransformer();
	locatorTransformer.applyTo(pmml);

	ModelEvaluatorFactory modelEvaluatorFactory = ModelEvaluatorFactory.newInstance();

	ModelEvaluator<?> modelEvaluator = modelEvaluatorFactory.newModelManager(pmml);
	modelEvaluator.verify();

	return modelEvaluator;
}
 
开发者ID:jpmml,项目名称:jpmml-cascading,代码行数:18,代码来源:PMMLPlannerUtil.java

示例4: setUp

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
@PostConstruct
public void setUp() throws IOException, SAXException, JAXBException {
	try (InputStream is = properties.getModelLocation().getInputStream()) {
		Source transformedSource = ImportFilter.apply(new InputSource(is));
		pmml = JAXBUtil.unmarshalPMML(transformedSource);
		Assert.state(!pmml.getModels().isEmpty(),
				"The provided PMML file at " + properties.getModelLocation() + " does not contain any model");
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:10,代码来源:PmmlProcessorConfiguration.java

示例5: unmarshal

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
static
private PMML unmarshal(File file) throws Exception {

	try(InputStream is = new FileInputStream(file)){
		Source source = ImportFilter.apply(new InputSource(is));

		return JAXBUtil.unmarshalPMML(source);
	}
}
 
开发者ID:vruusmann,项目名称:jpmml-toolkit,代码行数:10,代码来源:Aggregator.java

示例6: createEvaluator

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
private static Evaluator createEvaluator(String filePath) throws SAXException, JAXBException, IOException{
	InputStream is = new FileInputStream(new File(filePath));
	PMML pmml;
	try {
		Source source = ImportFilter.apply(new InputSource(is));
		pmml = JAXBUtil.unmarshalPMML(source);
	} finally {
		is.close();
	}
	PMMLManager pmmlManager = new PMMLManager(pmml);
	return (Evaluator)pmmlManager.getModelManager(ModelEvaluatorFactory.getInstance());		
}
 
开发者ID:selvinsource,项目名称:spark-pmml-exporter-validator,代码行数:13,代码来源:SparkPMMLExporterValidator.java

示例7: createEvaluator

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
static
public Evaluator createEvaluator(InputStream is) throws SAXException, JAXBException {
	Source source = ImportFilter.apply(new InputSource(is));

	PMML pmml = JAXBUtil.unmarshalPMML(source);

	// If the SAX Locator information is available, then transform it to java.io.Serializable representation
	LocatorTransformer locatorTransformer = new LocatorTransformer();
	locatorTransformer.applyTo(pmml);

	ModelEvaluatorFactory modelEvaluatorFactory = ModelEvaluatorFactory.newInstance();

	Evaluator evaluator = modelEvaluatorFactory.newModelEvaluator(pmml);

	// Perform self-testing
	evaluator.verify();

	return evaluator;
}
 
开发者ID:jeremyore,项目名称:spark-pmml-import,代码行数:20,代码来源:EvaluatorUtil.java

示例8: createEvaluator

import org.jpmml.model.ImportFilter; //导入方法依赖的package包/类
static
public Evaluator createEvaluator(InputStream is) throws SAXException, JAXBException {
	Source source = ImportFilter.apply(new InputSource(is));

	PMML pmml = JAXBUtil.unmarshalPMML(source);

	// If the SAX Locator information is available, then transform it to java.io.Serializable representation
	LocatorTransformer locatorTransformer = new LocatorTransformer();
	pmml.accept(locatorTransformer);

	ModelEvaluatorFactory modelEvaluatorFactory = ModelEvaluatorFactory.newInstance();

	ModelEvaluator<?> modelEvaluator = modelEvaluatorFactory.newModelManager(pmml);

	return modelEvaluator;
}
 
开发者ID:jpmml,项目名称:jpmml-storm,代码行数:17,代码来源:PMMLBoltUtil.java


注:本文中的org.jpmml.model.ImportFilter.apply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。