- Timestamp:
- 07/07/08 16:59:35 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.StructureIdentification/Evaluation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/CoefficientOfDeterminationEvaluator.cs
r363 r367 44 44 45 45 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 46 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 47 int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 46 48 double errorsSquaredSum = 0.0; 47 49 double originalDeviationTotalSumOfSquares = 0.0; 48 double targetMean = dataset.GetMean(targetVariable );50 double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd); 49 51 functionTree.PrepareEvaluation(dataset); 50 for(int sample = 0; sample < dataset.Rows; sample++) {52 for(int sample = trainingStart; sample < trainingEnd; sample++) { 51 53 double estimated = functionTree.Evaluate(sample); 52 54 double original = dataset.GetValue(sample, targetVariable); -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/EarlyStoppingMeanSquaredErrorEvaluator.cs
r363 r367 59 59 } 60 60 double errorsSquaredSum = 0; 61 double targetMean = dataset.GetMean(targetVariable );61 double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd); 62 62 functionTree.PrepareEvaluation(dataset); 63 63 for(int sample = trainingStart; sample < trainingEnd; sample++) { -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MCCEvaluator.cs
r363 r367 46 46 private double[] estimated = new double[1]; 47 47 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 48 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 49 int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 50 int nSamples = trainingEnd-trainingStart; 48 51 double limit = GetVariableValue<DoubleData>("ClassSeparation", scope, false).Data; 49 if(estimated.Length != dataset.Rows) {50 estimated = new double[ dataset.Rows];51 original = new double[ dataset.Rows];52 if(estimated.Length != nSamples) { 53 estimated = new double[nSamples]; 54 original = new double[nSamples]; 52 55 } 56 53 57 double positive = 0; 54 58 double negative = 0; 55 double targetMean = dataset.GetMean(targetVariable );59 double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd); 56 60 functionTree.PrepareEvaluation(dataset); 57 for(int sample = 0; sample < dataset.Rows; sample++) {61 for(int sample = trainingStart; sample < trainingEnd; sample++) { 58 62 double est = functionTree.Evaluate(sample); 59 63 double orig = dataset.GetValue(sample, targetVariable); … … 65 69 est = targetMean - maximumPunishment; 66 70 } 67 estimated[sample ] = est;68 original[sample ] = orig;71 estimated[sample-trainingStart] = est; 72 original[sample-trainingStart] = orig; 69 73 if(orig >= limit) positive++; 70 74 else negative++; -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanSquaredErrorEvaluator.cs
r363 r367 48 48 49 49 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 50 double errorsSquaredSum = 0;51 double targetMean = dataset.GetMean(targetVariable);52 bool useEstimatedValues = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, false).Data;53 50 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 54 51 int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 52 double errorsSquaredSum = 0; 53 double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd); 54 bool useEstimatedValues = GetVariableValue<BoolData>("UseEstimatedTargetValue", scope, false).Data; 55 55 if(useEstimatedValues && backupValues == null) { 56 56 backupValues = new double[trainingEnd - trainingStart]; -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/VarianceAccountedForEvaluator.cs
r363 r367 54 54 55 55 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 56 double[] errors = new double[dataset.Rows]; 57 double[] originalTargetVariableValues = new double[dataset.Rows]; 58 double targetMean = dataset.GetMean(targetVariable); 56 int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 57 int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 58 double[] errors = new double[trainingEnd-trainingStart]; 59 double[] originalTargetVariableValues = new double[trainingEnd-trainingStart]; 60 double targetMean = dataset.GetMean(targetVariable, trainingStart, trainingEnd); 59 61 functionTree.PrepareEvaluation(dataset); 60 for(int sample = 0; sample < dataset.Rows; sample++) {62 for(int sample = trainingStart; sample < trainingEnd; sample++) { 61 63 double estimated = functionTree.Evaluate(sample); 62 64 double original = dataset.GetValue(sample, targetVariable); … … 70 72 } 71 73 72 errors[sample ] = original - estimated;73 originalTargetVariableValues[sample ] = original;74 errors[sample-trainingStart] = original - estimated; 75 originalTargetVariableValues[sample-trainingStart] = original; 74 76 } 75 77
Note: See TracChangeset
for help on using the changeset viewer.