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


Java IntegrationTestBatch类代码示例

本文整理汇总了Java中org.jpmml.evaluator.IntegrationTestBatch的典型用法代码示例。如果您正苦于以下问题:Java IntegrationTestBatch类的具体用法?Java IntegrationTestBatch怎么用?Java IntegrationTestBatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createBatch

import org.jpmml.evaluator.IntegrationTestBatch; //导入依赖的package包/类
@Override
protected Batch createBatch(String name, String dataset, Predicate<FieldName> predicate){
	Batch result = new IntegrationTestBatch(name, dataset, predicate){

		@Override
		public ClassificationTest getIntegrationTest(){
			return ClassificationTest.this;
		}

		@Override
		public PMML getPMML() throws Exception {
			PMML pmml = super.getPMML();

			ExpressionCorrector expressionCorrector = new ExpressionCorrector();
			expressionCorrector.applyTo(pmml);

			return pmml;
		}
	};

	return result;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:23,代码来源:ClassificationTest.java

示例2: createBatch

import org.jpmml.evaluator.IntegrationTestBatch; //导入依赖的package包/类
protected ArchiveBatch createBatch(String name, String dataset, Predicate<FieldName> predicate, final Class<? extends Converter<? extends RExp>> clazz){
	ArchiveBatch result = new IntegrationTestBatch(name, dataset, predicate){

		@Override
		public IntegrationTest getIntegrationTest(){
			return ConverterTest.this;
		}

		@Override
		public PMML getPMML() throws Exception {

			try(InputStream is = open("/rds/" + getName() + getDataset() + ".rds")){
				RExpParser parser = new RExpParser(is);

				RExp rexp = parser.parse();

				PMML pmml = convert(rexp, clazz);

				ensureValidity(pmml);

				return pmml;
			}
		}
	};

	return result;
}
 
开发者ID:jpmml,项目名称:jpmml-r,代码行数:28,代码来源:ConverterTest.java

示例3: createBatch

import org.jpmml.evaluator.IntegrationTestBatch; //导入依赖的package包/类
@Override
protected ArchiveBatch createBatch(String name, String dataset, Predicate<FieldName> predicate){
	ArchiveBatch result = new IntegrationTestBatch(name, dataset, predicate){

		@Override
		public IntegrationTest getIntegrationTest(){
			return EstimatorTest.this;
		}

		@Override
		public PMML getPMML() throws Exception {
			File savedModelDir = getSavedModelDir();

			SavedModelBundle bundle = SavedModelBundle.load(savedModelDir.getAbsolutePath(), "serve");

			try(SavedModel savedModel = new SavedModel(bundle)){
				EstimatorFactory estimatorFactory = EstimatorFactory.newInstance();

				Estimator estimator = estimatorFactory.newEstimator(savedModel);

				PMML pmml = estimator.encodePMML();

				ensureValidity(pmml);

				return pmml;
			}
		}

		private File getSavedModelDir() throws IOException, URISyntaxException {
			ClassLoader classLoader = (EstimatorTest.this.getClass()).getClassLoader();

			String protoPath = ("savedmodel/" + getName() + getDataset() + "/saved_model.pbtxt");

			URL protoResource = classLoader.getResource(protoPath);
			if(protoResource == null){
				throw new NoSuchFileException(protoPath);
			}

			File protoFile = (Paths.get(protoResource.toURI())).toFile();

			return protoFile.getParentFile();
		}
	};

	return result;
}
 
开发者ID:jpmml,项目名称:jpmml-tensorflow,代码行数:47,代码来源:EstimatorTest.java


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