コード例 #1
0
  /**
   * Creates a new performance vector if the given one is null. Adds a new estimated criterion. If
   * the criterion was already part of the performance vector before it will be overwritten.
   */
  private PerformanceVector count(KernelModel model, PerformanceVector performanceCriteria)
      throws OperatorException {
    if (performanceCriteria == null) performanceCriteria = new PerformanceVector();

    this.lastCount = 0;
    int svNumber = model.getNumberOfSupportVectors();
    for (int i = 0; i < svNumber; i++) {
      SupportVector sv = model.getSupportVector(i);
      if (Math.abs(sv.getAlpha()) > 0.0d) this.lastCount++;
    }
    EstimatedPerformance svCriterion =
        new EstimatedPerformance(
            "number_of_support_vectors",
            lastCount,
            1,
            getParameterAsInt(PARAMETER_OPTIMIZATION_DIRECTION) == MDLCriterion.MINIMIZATION);
    performanceCriteria.addCriterion(svCriterion);
    return performanceCriteria;
  }