Free cookie consent management tool by TermsFeed Policy Generator

Changeset 200


Ignore:
Timestamp:
04/28/08 09:16:33 (16 years ago)
Author:
gkronber
Message:

added a counter for the total number of evaluated nodes.

Location:
trunk/sources/HeuristicLab.StructureIdentification/Evaluation
Files:
3 edited

Legend:

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

    r155 r200  
    6363
    6464        // check the limit and stop as soon as we hit the limit
    65         if(errorsSquaredSum / dataset.Rows >= qualityLimit)
    66           return errorsSquaredSum / (sample+1); // return estimated MSE (when the remaining errors are on average the same)
     65        if(errorsSquaredSum / dataset.Rows >= qualityLimit) {
     66          scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * sample+1;
     67          return errorsSquaredSum / (sample + 1); // return estimated MSE (when the remaining errors are on average the same)
     68        }
    6769      }
    6870      errorsSquaredSum /= dataset.Rows;
     
    7072        errorsSquaredSum = double.MaxValue;
    7173      }
     74      scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * dataset.Rows;
    7275      return errorsSquaredSum;
    7376    }
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/GPEvaluatorBase.cs

    r155 r200  
    3333  public abstract class GPEvaluatorBase : OperatorBase {
    3434    protected double maximumPunishment;
     35    protected int treeSize;
     36    protected double totalEvaluatedNodes;
    3537
    3638    public GPEvaluatorBase()
    3739      : base() {
    3840      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IFunctionTree), VariableKind.In));
     41      AddVariableInfo(new VariableInfo("TreeSize", "Size (number of nodes) of the tree to evaluate", typeof(IntData), VariableKind.In));
    3942      AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In));
    4043      AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));
    4144      AddVariableInfo(new VariableInfo("PunishmentFactor", "Punishment factor for invalid estimations", typeof(DoubleData), VariableKind.In));
     45      AddVariableInfo(new VariableInfo("TotalEvaluatedNodes", "Number of evaluated nodes", typeof(DoubleData), VariableKind.In | VariableKind.Out));
    4246      AddVariableInfo(new VariableInfo("Quality", "The evaluated quality of the model", typeof(DoubleData), VariableKind.New));
    4347    }
     
    4852      IFunctionTree functionTree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
    4953      this.maximumPunishment = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data * dataset.GetRange(targetVariable);
     54      this.treeSize = scope.GetVariableValue<IntData>("TreeSize", false).Data;
     55      this.totalEvaluatedNodes = scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data;
    5056
    5157      double result = Evaluate(scope, functionTree, targetVariable, dataset);
  • trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanSquaredErrorEvaluator.cs

    r155 r200  
    6464        errorsSquaredSum = double.MaxValue;
    6565      }
     66      scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * dataset.Rows;
    6667      return errorsSquaredSum;
    6768    }
Note: See TracChangeset for help on using the changeset viewer.