- Timestamp:
- 05/14/09 13:46:57 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/AccuracyEvaluator.cs
r1529 r1796 43 43 } 44 44 45 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {45 public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) { 46 46 DoubleData accuracy = GetVariableValue<DoubleData>("Accuracy", scope, false, false); 47 47 if (accuracy == null) { … … 53 53 int nCorrect = 0; 54 54 for (int sample = start; sample < end; sample++) { 55 double est = evaluator.Evaluate( sample);55 double est = evaluator.Evaluate(tree, sample); 56 56 double origClass = dataset.GetValue(sample, targetVariable); 57 57 double estClass = double.NaN; -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ClassificationMeanSquaredErrorEvaluator.cs
r1529 r1796 43 43 } 44 44 45 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {45 public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) { 46 46 double errorsSquaredSum = 0; 47 47 for (int sample = start; sample < end; sample++) { 48 double estimated = evaluator.Evaluate( sample);48 double estimated = evaluator.Evaluate(tree, sample); 49 49 double original = dataset.GetValue(sample, targetVariable); 50 50 if (!double.IsNaN(original) && !double.IsInfinity(original)) { -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/ConfusionMatrixEvaluator.cs
r1529 r1796 41 41 } 42 42 43 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) {43 public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end) { 44 44 IntMatrixData matrix = GetVariableValue<IntMatrixData>("ConfusionMatrix", scope, false, false); 45 45 if (matrix == null) { … … 50 50 int nSamples = end - start; 51 51 for (int sample = start; sample < end; sample++) { 52 double est = evaluator.Evaluate( sample);52 double est = evaluator.Evaluate(tree, sample); 53 53 double origClass = dataset.GetValue(sample, targetVariable); 54 54 int estClassIndex = -1; -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/GPClassificationEvaluatorBase.cs
r1529 r1796 37 37 } 38 38 39 public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {39 public override void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) { 40 40 41 41 ItemList<DoubleData> classes = GetVariableValue<ItemList<DoubleData>>("TargetClassValues", scope, true); … … 48 48 } 49 49 50 Evaluate(scope, evaluator, dataset, targetVariable, classesArr, thresholds, start, end);50 Evaluate(scope, evaluator, tree, dataset, targetVariable, classesArr, thresholds, start, end); 51 51 } 52 52 53 public abstract void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end);53 public abstract void Evaluate(IScope scope, ITreeEvaluator evaluator, IFunctionTree tree, Dataset dataset, int targetVariable, double[] classes, double[] thresholds, int start, int end); 54 54 } 55 55 } -
trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/MulticlassOneVsOneAnalyzer.cs
r1529 r1796 35 35 private const string TARGETVARIABLE = "TargetVariable"; 36 36 private const string TARGETCLASSVALUES = "TargetClassValues"; 37 private const string TRAININGSAMPLESSTART = "TrainingSamplesStart"; 38 private const string TRAININGSAMPLESEND = "TrainingSamplesEnd"; 37 39 private const string SAMPLESSTART = "SamplesStart"; 38 40 private const string SAMPLESEND = "SamplesEnd"; … … 56 58 AddVariableInfo(new VariableInfo(CLASSAVALUE, "The original class value of the class A in the subscope", typeof(DoubleData), VariableKind.In)); 57 59 AddVariableInfo(new VariableInfo(CLASSBVALUE, "The original class value of the class B in the subscope", typeof(DoubleData), VariableKind.In)); 60 AddVariableInfo(new VariableInfo(TRAININGSAMPLESSTART, "The start of training samples in the original dataset", typeof(IntData), VariableKind.In)); 61 AddVariableInfo(new VariableInfo(TRAININGSAMPLESEND, "The end of training samples in the original dataset", typeof(IntData), VariableKind.In)); 58 62 AddVariableInfo(new VariableInfo(SAMPLESSTART, "The start of samples in the original dataset", typeof(IntData), VariableKind.In)); 59 63 AddVariableInfo(new VariableInfo(SAMPLESEND, "The end of samples in the original dataset", typeof(IntData), VariableKind.In)); … … 67 71 Dataset dataset = GetVariableValue<Dataset>(DATASET, scope, true); 68 72 int targetVariable = GetVariableValue<IntData>(TARGETVARIABLE, scope, true).Data; 73 int trainingSamplesStart = GetVariableValue<IntData>(TRAININGSAMPLESSTART, scope, true).Data; 74 int trainingSamplesEnd = GetVariableValue<IntData>(TRAININGSAMPLESEND, scope, true).Data; 69 75 int samplesStart = GetVariableValue<IntData>(SAMPLESSTART, scope, true).Data; 70 76 int samplesEnd = GetVariableValue<IntData>(SAMPLESEND, scope, true).Data; … … 79 85 80 86 BakedTreeEvaluator evaluator = new BakedTreeEvaluator(); 81 evaluator.ResetEvaluator( functionTree, dataset, targetVariable, samplesStart, samplesEnd, 1.0);87 evaluator.ResetEvaluator(dataset, targetVariable, trainingSamplesStart, trainingSamplesEnd, 1.0); 82 88 83 89 for(int i = 0; i < (samplesEnd - samplesStart); i++) { 84 double est = evaluator.Evaluate( i + samplesStart);90 double est = evaluator.Evaluate(functionTree, i + samplesStart); 85 91 if(est < 0.5) { 86 92 CastVote(votes, i, classAValue, classValues);
Note: See TracChangeset
for help on using the changeset viewer.