Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/14/10 10:45:41 (14 years ago)
Author:
mkommend
Message:

implemented first version of partially evaluation of samples (ticket #1082)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r3985 r4034  
    9191        root.AddSubTree(start);
    9292        start.AddSubTree(simplifiedExpressionTree.Root);
     93        int samplesStart = Content.ProblemData.TrainingSamplesStart.Value;
     94        int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;
    9395        double originalTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(
    9496            Content.Model.Interpreter, new SymbolicExpressionTree(root), Content.LowerEstimationLimit, Content.UpperEstimationLimit,
    9597            Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value,
    96             Content.ProblemData.TrainingSamplesStart.Value, Content.ProblemData.TrainingSamplesEnd.Value);
     98            Enumerable.Range(samplesStart, samplesEnd - samplesStart));
    9799
    98100        this.CalculateReplacementNodes();
     
    112114      SymbolicExpressionTree tree = new SymbolicExpressionTree(root);
    113115      foreach (SymbolicExpressionTreeNode node in this.simplifiedExpressionTree.IterateNodesPrefix()) {
    114         while(start.SubTrees.Count > 0) start.RemoveSubTree(0);
     116        while (start.SubTrees.Count > 0) start.RemoveSubTree(0);
    115117        start.AddSubTree(node);
    116118        double constantTreeNodeValue = interpreter.GetSymbolicExpressionTreeValues(tree, Content.ProblemData.Dataset, trainingSamples).Median();
     
    123125      foreach (SymbolicExpressionTreeNode childNode in currentTreeNode.SubTrees.ToList()) {
    124126        SwitchNode(currentTreeNode, childNode, replacementNodes[childNode]);
     127        int samplesStart = Content.ProblemData.TrainingSamplesStart.Value;
     128        int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;
    125129        double newTrainingMeanSquaredError = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(
    126130          Content.Model.Interpreter, tree,
    127131          Content.LowerEstimationLimit, Content.UpperEstimationLimit,
    128132          Content.ProblemData.Dataset, Content.ProblemData.TargetVariable.Value,
    129           Content.ProblemData.TrainingSamplesStart.Value, Content.ProblemData.TrainingSamplesEnd.Value);
     133          Enumerable.Range(samplesStart, samplesEnd - samplesStart));
    130134        nodeImpacts[childNode] = newTrainingMeanSquaredError / originalTrainingMeanSquaredError;
    131135        SwitchNode(currentTreeNode, replacementNodes[childNode], childNode);
Note: See TracChangeset for help on using the changeset viewer.