Ejemplo n.º 1
0
  @Override
  public double[] getEvaluations(Instances testSet) {

    final double[] results = new double[12];
    Arrays.fill(results, 0);

    final VotingClassificationStrategy str =
        rep
        .new VotingClassificationStrategy(
            (float) SettingsLoader.getNumericSetting("datasetLabelCardinality", 1));
    rep.setClassificationStrategy(str);

    str.proportionalCutCalibration(this.instances, rulePopulation);

    final AccuracyRecallEvaluator accEval =
        new AccuracyRecallEvaluator(testSet, false, this, AccuracyRecallEvaluator.TYPE_ACCURACY);
    results[0] = accEval.getMetric(this);

    final AccuracyRecallEvaluator recEval =
        new AccuracyRecallEvaluator(testSet, false, this, AccuracyRecallEvaluator.TYPE_RECALL);
    results[1] = recEval.getMetric(this);

    final HammingLossEvaluator hamEval =
        new HammingLossEvaluator(testSet, false, numberOfLabels, this);
    results[2] = hamEval.getMetric(this);

    final ExactMatchEvalutor testEval = new ExactMatchEvalutor(testSet, false, this);
    results[3] = testEval.getMetric(this);

    final AccuracyRecallEvaluator selfAcc =
        new AccuracyRecallEvaluator(instances, false, this, AccuracyRecallEvaluator.TYPE_ACCURACY);
    final InternalValidation ival = new InternalValidation(this, str, selfAcc);
    ival.calibrate(15);

    results[4] = accEval.getMetric(this);
    results[5] = recEval.getMetric(this);
    results[6] = hamEval.getMetric(this);
    results[7] = testEval.getMetric(this);

    rep.setClassificationStrategy(
        new StrictMultiLabelRepresentation.BestFitnessClassificationStrategy());

    results[8] = accEval.getMetric(this);
    results[9] = recEval.getMetric(this);
    results[10] = hamEval.getMetric(this);
    results[11] = testEval.getMetric(this);

    return results;
  }
Ejemplo n.º 2
0
  @Override
  public double[] getEvaluations(Instances testSet) {
    final double[] results = new double[12];
    Arrays.fill(results, 0);

    proportionalCutCalibration();

    final AccuracyRecallEvaluator accEval =
        new AccuracyRecallEvaluator(testSet, false, this, AccuracyRecallEvaluator.TYPE_ACCURACY);
    results[0] = accEval.getMetric(this);

    final AccuracyRecallEvaluator recEval =
        new AccuracyRecallEvaluator(testSet, false, this, AccuracyRecallEvaluator.TYPE_RECALL);
    results[1] = recEval.getMetric(this);

    final HammingLossEvaluator hamEval =
        new HammingLossEvaluator(testSet, false, numberOfLabels, this);
    results[2] = hamEval.getMetric(this);

    final ExactMatchEvalutor testEval = new ExactMatchEvalutor(testSet, false, this);
    results[3] = testEval.getMetric(this);

    final AccuracyRecallEvaluator selfAcc =
        new AccuracyRecallEvaluator(instances, false, this, AccuracyRecallEvaluator.TYPE_ACCURACY);
    internalValidationCalibration(selfAcc);

    results[4] = accEval.getMetric(this);
    results[5] = recEval.getMetric(this);
    results[6] = hamEval.getMetric(this);
    results[7] = testEval.getMetric(this);

    useBestClassificationMode();

    results[8] = accEval.getMetric(this);
    results[9] = recEval.getMetric(this);
    results[10] = hamEval.getMetric(this);
    results[11] = testEval.getMetric(this);

    return results;
  }