Free cookie consent management tool by TermsFeed Policy Generator

Changeset 170


Ignore:
Timestamp:
04/23/08 12:06:58 (17 years ago)
Author:
gkronber
Message:

small improvement for MCCEvaluator (ticket #69)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MCCEvaluator.cs

    r169 r170  
    3838    }
    3939
    40     double limit = 50.0;
    4140    public MCCEvaluator()
    4241      : base() {
     42      AddVariableInfo(new VariableInfo("ClassSeparation", "The value of separation between negative and positive target classification values (for instance 0.5 if negative=0 and positive=1).", typeof(DoubleData), VariableKind.In));
    4343    }
    4444
    4545    public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) {
     46      double limit = GetVariableValue<DoubleData>("ClassSeparation", scope, false).Data;
    4647      double[] estimated = new double[dataset.Rows];
    4748      double[] original = new double[dataset.Rows];
     
    6566      }
    6667      Array.Sort(estimated, original);
    67       double best_mcc = 0.0;
     68      double best_mcc = -1.0;
    6869      double tp = 0;
    6970      double fn = positive;
     
    7677          tn--; fp++;
    7778        }
    78         double mcc = (tp * tn - fp * fn) / Math.Sqrt((tp + fp) * (tp + fn) * (tn + fp) * (tn + fn));
     79        double mcc = (tp * tn - fp * fn) / Math.Sqrt(positive * (tp + fn) * (tn + fp) * negative);
    7980        if(best_mcc < mcc) {
    8081          best_mcc = mcc;
Note: See TracChangeset for help on using the changeset viewer.