protected void setLayout()

in samoa-api/src/main/java/org/apache/samoa/learners/classifiers/ensemble/BoostVHT.java [128:187]


  protected void setLayout() {

    int ensembleSize = this.ensembleSizeOption.getValue();

    // Set parameters for BoostVHT processor, and the BoostMA processors within.
    try {
      boostVHTProcessor = new BoostVHTProcessor.Builder(dataset)
          .ensembleSize(this.ensembleSizeOption.getValue())
          .numberOfClasses(this.numberOfClassesOption.getValue())
          .splitCriterion(
              (SplitCriterion) ClassOption.createObject(this.splitCriterionOption.getValueAsCLIString(),
              this.splitCriterionOption.getRequiredType()))
          .splitConfidence(this.splitConfidenceOption.getValue())
          .tieThreshold(this.tieThresholdOption.getValue())
          .gracePeriod(this.gracePeriodOption.getValue())
          .parallelismHint(this.ensembleSizeOption.getValue())
          .timeOut(this.timeOutOption.getValue())
          .splittingOption(this.splittingOption.isSet() ? SplittingOption.KEEP: SplittingOption.THROW_AWAY)
          .maxBufferSize(this.maxBufferSizeOption.getValue())
          .seed(this.seedOption.getValue())
          .build();
    } catch (Exception e) {
      e.printStackTrace();
    }

    //add Boosting Model Aggregator Processor to the topology
    this.topologyBuilder.addProcessor(boostVHTProcessor, 1);
    

    // Streams
    attributeStream = this.topologyBuilder.createStream(boostVHTProcessor);
    controlStream = this.topologyBuilder.createStream(boostVHTProcessor);
    
    //local statistics processor.
    LocalStatisticsProcessor locStatProcessor = new LocalStatisticsProcessor.Builder()
        .splitCriterion((SplitCriterion) this.splitCriterionOption.getValue())
        .binarySplit(this.binarySplitsOption.isSet())
        .nominalClassObserver((AttributeClassObserver) this.nominalEstimatorOption.getValue())
        .numericClassObserver((AttributeClassObserver) this.numericEstimatorOption.getValue())
        .build();
    
    this.topologyBuilder.addProcessor(locStatProcessor, ensembleSize);
  
    this.topologyBuilder.connectInputKeyStream(attributeStream, locStatProcessor);
    this.topologyBuilder.connectInputAllStream(controlStream, locStatProcessor);
    
    
    //local statistics result stream
    computeStream = this.topologyBuilder.createStream(locStatProcessor);
    locStatProcessor.setComputationResultStream(computeStream);
    this.topologyBuilder.connectInputAllStream(computeStream, boostVHTProcessor);
  
    //prediction is computed in boostVHTProcessor
    resultStream = this.topologyBuilder.createStream(boostVHTProcessor);
    
    //set the out streams of the BoostVHTProcessor
    boostVHTProcessor.setResultStream(resultStream);
    boostVHTProcessor.setAttributeStream(attributeStream);
    boostVHTProcessor.setControlStream(controlStream);
  }