示例#1
0
 @Override
 protected void normalizeAttributes(Dataset Data) {
   for (BaseEntry entry : Data.getEntries()) {
     double[] attr = entry.getAttributes();
     for (int i = 0; i < attr.length; i++) {
       attr[i] = attr[i] == 0 ? 0 : Scale / attr[i];
     }
     entry.setAttributes(attr);
   }
 }
示例#2
0
 @Override
 protected void normalizeClassVariable(Dataset Data) {
   for (BaseEntry entry : Data.getEntries()) {
     if (entry.hasMeasurement()) {
       double x = entry.getMeasuredClass();
       x = x == 0 ? 0.0 : Scale / x;
       entry.setMeasuredClass(x);
     }
     if (entry.hasPrediction()) {
       double x = entry.getPredictedClass();
       x = x == 0 ? 0.0 : Scale / x;
       entry.setPredictedClass(x);
     }
   }
 }
示例#3
0
  @Override
  protected boolean[] label(Dataset D) {
    if (useMeasured && (!D.getEntry(0).hasMeasurement()))
      throw new Error("Missing measured class.");
    if (!useMeasured && (!D.getEntry(0).hasPrediction()))
      throw new Error("Missing predicted class.");

    boolean[] output = new boolean[D.NEntries()];
    for (int i = 0; i < D.NEntries(); i++) {
      boolean isInside = false;
      double value =
          useMeasured ? D.getEntry(i).getMeasuredClass() : D.getEntry(i).getPredictedClass();
      if (value > lowerBound && value < upperBound) output[i] = insideRange;
      else output[i] = !insideRange;
    }
    return output;
  }