- Timestamp:
- 04/22/08 18:05:14 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.StructureIdentification/Evaluation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/CoefficientOfDeterminationEvaluator.cs
r128 r155 34 34 public override string Description { 35 35 get { 36 return @" Applies 'OperatorTree' toall samples of 'Dataset' and calculates36 return @"Evaluates 'FunctionTree' for all samples of 'Dataset' and calculates 37 37 the 'coefficient of determination' of estimated values vs. real values of 'TargetVariable'."; 38 38 } … … 43 43 } 44 44 45 public override double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset) {45 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 46 46 double errorsSquaredSum = 0.0; 47 47 double originalDeviationTotalSumOfSquares = 0.0; 48 48 double targetMean = dataset.GetMean(targetVariable); 49 49 for(int sample = 0; sample < dataset.Rows; sample++) { 50 double estimated = function .Evaluate(dataset, sample);50 double estimated = functionTree.Evaluate(dataset, sample); 51 51 double original = dataset.GetValue(sample, targetVariable); 52 52 if(!double.IsNaN(original) && !double.IsInfinity(original)) { -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/EarlyStoppingMeanSquaredErrorEvaluator.cs
r136 r155 34 34 public override string Description { 35 35 get { 36 return @"Evaluates ' OperatorTree' for all samples of the dataset and calculates the mean-squared-error36 return @"Evaluates 'FunctionTree' for all samples of the dataset and calculates the mean-squared-error 37 37 for the estimated values vs. the real values of 'TargetVariable'. 38 38 This operator stops the computation as soon as an upper limit for the mean-squared-error is reached."; … … 45 45 } 46 46 47 public override double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset) {47 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 48 48 double qualityLimit = GetVariableValue<DoubleData>("QualityLimit", scope, false).Data; 49 49 double errorsSquaredSum = 0; 50 50 double targetMean = dataset.GetMean(targetVariable); 51 51 for(int sample = 0; sample < dataset.Rows; sample++) { 52 double estimated = function .Evaluate(dataset, sample);52 double estimated = functionTree.Evaluate(dataset, sample); 53 53 double original = dataset.GetValue(sample, targetVariable); 54 54 if(double.IsNaN(estimated) || double.IsInfinity(estimated)) { -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/GPEvaluatorBase.cs
r135 r155 36 36 public GPEvaluatorBase() 37 37 : base() { 38 AddVariableInfo(new VariableInfo(" OperatorTree", "The function tree that should be evaluated", typeof(IFunction), VariableKind.In));38 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In)); 39 39 AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In)); 40 40 AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In)); … … 46 46 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data; 47 47 Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true); 48 IFunction function = GetVariableValue<IFunction>("OperatorTree", scope, true);48 IFunctionTree functionTree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true); 49 49 this.maximumPunishment = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data * dataset.GetRange(targetVariable); 50 50 51 double result = Evaluate(scope, function , targetVariable, dataset);51 double result = Evaluate(scope, functionTree, targetVariable, dataset); 52 52 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Quality"), new DoubleData(result))); 53 53 return null; 54 54 } 55 55 56 public abstract double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset);56 public abstract double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset); 57 57 } 58 58 } -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanSquaredErrorEvaluator.cs
r128 r155 34 34 public override string Description { 35 35 get { 36 return @"Evaluates ' OperatorTree' for all samples of 'DataSet' and calculates the mean-squared-error36 return @"Evaluates 'FunctionTree' for all samples of 'DataSet' and calculates the mean-squared-error 37 37 for the estimated values vs. the real values of 'TargetVariable'."; 38 38 } … … 43 43 } 44 44 45 public override double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset) {45 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 46 46 double errorsSquaredSum = 0; 47 47 double targetMean = dataset.GetMean(targetVariable); 48 48 for(int sample = 0; sample < dataset.Rows; sample++) { 49 double estimated = function.Evaluate(dataset, sample); 49 50 double estimated = functionTree.Evaluate(dataset, sample); 50 51 double original = dataset.GetValue(sample, targetVariable); 51 52 if(double.IsNaN(estimated) || double.IsInfinity(estimated)) { -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/VarianceAccountedForEvaluator.cs
r128 r155 34 34 public override string Description { 35 35 get { 36 return @"Evaluates ' OperatorTree' for all samples of 'DataSet' and calculates36 return @"Evaluates 'FunctionTree' for all samples of 'DataSet' and calculates 37 37 the variance-accounted-for quality measure for the estimated values vs. the real values of 'TargetVariable'. 38 38 … … 53 53 54 54 55 public override double Evaluate(IScope scope, IFunction function, int targetVariable, Dataset dataset) {55 public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) { 56 56 double[] errors = new double[dataset.Rows]; 57 57 double[] originalTargetVariableValues = new double[dataset.Rows]; 58 58 double targetMean = dataset.GetMean(targetVariable); 59 59 for(int sample = 0; sample < dataset.Rows; sample++) { 60 double estimated = function .Evaluate(dataset, sample);60 double estimated = functionTree.Evaluate(dataset, sample); 61 61 double original = dataset.GetValue(sample, targetVariable); 62 62 if(!double.IsNaN(original) && !double.IsInfinity(original)) {
Note: See TracChangeset
for help on using the changeset viewer.