Free cookie consent management tool by TermsFeed Policy Generator

# Changeset 5993 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs

Ignore:
Timestamp:
04/08/11 21:41:53 (13 years ago)
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

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

 r5942 protected override Dictionary CalculateReplacementValues(ISymbolicExpressionTree tree) { Dictionary replacementValues = new Dictionary(); foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) { if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) { replacementValues[node] = CalculateReplacementValue(node); } foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { replacementValues[node] = CalculateReplacementValue(node, tree); } return replacementValues; foreach (ISymbolicExpressionTreeNode node in nodes) { var parent = node.Parent; constantNode.Value = CalculateReplacementValue(node); constantNode.Value = CalculateReplacementValue(node, tree); ISymbolicExpressionTreeNode replacementNode = constantNode; SwitchNode(parent, node, replacementNode); } private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) { private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) { // remove old ADFs while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1); // clone ADFs of source tree for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) { tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone()); } var start = tempTree.Root.GetSubtree(0); while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Note: See TracChangeset for help on using the changeset viewer.