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


Java ClassOption.createObject方法代码示例

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


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

示例1: setLayout

import com.github.javacliparser.ClassOption; //导入方法依赖的package包/类
/**
 * Sets the layout.
 */
protected void setLayout() {
  int ensembleSize = this.ensembleSizeOption.getValue();

  distributorP = new BaggingDistributorProcessor();
  distributorP.setEnsembleSize(ensembleSize);
  builder.addProcessor(distributorP, 1);

  // instantiate classifier
  ensemble = new AdaptiveLearner[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    try {
      ensemble[i] = (AdaptiveLearner) ClassOption.createObject(baseLearnerOption.getValueAsCLIString(),
          baseLearnerOption.getRequiredType());
    } catch (Exception e) {
      logger.error("Unable to create members of the ensemble. Please check your CLI parameters");
      e.printStackTrace();
      throw new IllegalArgumentException(e);
    }
    ensemble[i].setChangeDetector((ChangeDetector) this.driftDetectionMethodOption.getValue());
    ensemble[i].init(builder, this.dataset, 1); // sequential
  }

  PredictionCombinerProcessor predictionCombinerP = new PredictionCombinerProcessor();
  predictionCombinerP.setEnsembleSize(ensembleSize);
  this.builder.addProcessor(predictionCombinerP, 1);

  // Streams
  resultStream = builder.createStream(predictionCombinerP);
  predictionCombinerP.setOutputStream(resultStream);

  for (AdaptiveLearner member : ensemble) {
    for (Stream subResultStream : member.getResultStreams()) { // a learner can have multiple output streams
      this.builder.connectInputKeyStream(subResultStream, predictionCombinerP); // the key is the instance id to combine predictions
    }
  }

  ensembleStreams = new Stream[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    ensembleStreams[i] = builder.createStream(distributorP);
    builder.connectInputShuffleStream(ensembleStreams[i], ensemble[i].getInputProcessor()); // connect streams one-to-one with ensemble members (the type of connection does not matter)
  }

  distributorP.setOutputStreams(ensembleStreams);
}
 
开发者ID:apache,项目名称:incubator-samoa,代码行数:48,代码来源:AdaptiveBagging.java

示例2: setLayout

import com.github.javacliparser.ClassOption; //导入方法依赖的package包/类
/**
 * Sets the layout.
 */
protected void setLayout() {

  int ensembleSize = this.ensembleSizeOption.getValue();

  distributor = new ShardingDistributorProcessor();
  distributor.setEnsembleSize(ensembleSize);
  this.builder.addProcessor(distributor, 1);

  // instantiate classifier
  ensemble = new Learner[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    try {
      ensemble[i] = (Learner) ClassOption.createObject(baseLearnerOption.getValueAsCLIString(),
          baseLearnerOption.getRequiredType());
    } catch (Exception e) {
      logger.error("Unable to create members of the ensemble. Please check your CLI parameters");
      e.printStackTrace();
      throw new IllegalArgumentException(e);
    }
    ensemble[i].init(builder, this.dataset, 1); // sequential
  }

  PredictionCombinerProcessor predictionCombiner = new PredictionCombinerProcessor();
  predictionCombiner.setEnsembleSize(ensembleSize);
  this.builder.addProcessor(predictionCombiner, 1);

  // Streams
  resultStream = this.builder.createStream(predictionCombiner);
  predictionCombiner.setOutputStream(resultStream);

  for (Learner member : ensemble) {
    for (Stream subResultStream : member.getResultStreams()) { // a learner can have multiple output streams
      this.builder.connectInputKeyStream(subResultStream, predictionCombiner); // the key is the instance id to combine predictions
    }
  }

  ensembleStreams = new Stream[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    ensembleStreams[i] = builder.createStream(distributor);
    builder.connectInputShuffleStream(ensembleStreams[i], ensemble[i].getInputProcessor()); // connect streams one-to-one with ensemble members (the type of connection does not matter)
  }
  
  distributor.setOutputStreams(ensembleStreams);
}
 
开发者ID:apache,项目名称:incubator-samoa,代码行数:48,代码来源:Sharding.java

示例3: setLayout

import com.github.javacliparser.ClassOption; //导入方法依赖的package包/类
/**
 * Sets the layout.
 * 
 * @throws Exception
 */
protected void setLayout() {
  int ensembleSize = this.ensembleSizeOption.getValue();

  distributorP = new BaggingDistributorProcessor();
  distributorP.setEnsembleSize(ensembleSize);
  builder.addProcessor(distributorP, 1);

  // instantiate classifier
  ensemble = new Learner[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    try {
      ensemble[i] = (Learner) ClassOption.createObject(baseLearnerOption.getValueAsCLIString(),
          baseLearnerOption.getRequiredType());
    } catch (Exception e) {
      logger.error("Unable to create members of the ensemble. Please check your CLI parameters");
      e.printStackTrace();
      throw new IllegalArgumentException(e);
    }
    ensemble[i].init(builder, this.dataset, 1); // sequential
  }

  PredictionCombinerProcessor predictionCombinerP = new PredictionCombinerProcessor();
  predictionCombinerP.setEnsembleSize(ensembleSize);
  this.builder.addProcessor(predictionCombinerP, 1);

  // Streams
  resultStream = builder.createStream(predictionCombinerP);
  predictionCombinerP.setOutputStream(resultStream);

  for (Learner member : ensemble) {
    for (Stream subResultStream : member.getResultStreams()) { // a learner can have multiple output streams
      this.builder.connectInputKeyStream(subResultStream, predictionCombinerP); // the key is the instance id to combine predictions
    }
  }

  ensembleStreams = new Stream[ensembleSize];
  for (int i = 0; i < ensembleSize; i++) {
    ensembleStreams[i] = builder.createStream(distributorP);
    builder.connectInputShuffleStream(ensembleStreams[i], ensemble[i].getInputProcessor()); // connect streams one-to-one with ensemble members (the type of connection does not matter)
  }

  distributorP.setOutputStreams(ensembleStreams);
}
 
开发者ID:apache,项目名称:incubator-samoa,代码行数:49,代码来源:Bagging.java


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