Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/08/11 21:41:53 (14 years ago)
Author:
gkronber
Message:

#1418 fixed issues in interactive simplifier views for regression and classification solutions regarding automatic folding of nodes without impact on the solution quality and problems with ADFs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs

    r5942 r5993  
    5959    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
    6060      Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    61       foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) {
    62         if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) {
    63           replacementValues[node] = CalculateReplacementValue(node);
    64         }
     61      foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
     62        replacementValues[node] = CalculateReplacementValue(node, tree);
    6563      }
    6664      return replacementValues;
     
    9088      foreach (ISymbolicExpressionTreeNode node in nodes) {
    9189        var parent = node.Parent;
    92         constantNode.Value = CalculateReplacementValue(node);
     90        constantNode.Value = CalculateReplacementValue(node, tree);
    9391        ISymbolicExpressionTreeNode replacementNode = constantNode;
    9492        SwitchNode(parent, node, replacementNode);
     
    111109    }
    112110
    113     private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) {
     111    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
     112      // remove old ADFs
     113      while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1);
     114      // clone ADFs of source tree
     115      for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) {
     116        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
     117      }
    114118      var start = tempTree.Root.GetSubtree(0);
    115119      while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Note: See TracChangeset for help on using the changeset viewer.