本文整理汇总了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;
}
示例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;
}
示例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;
}