Changeset 3801 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers
- Timestamp:
- 05/13/10 20:28:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionSolutionLinearScaler.cs
r3710 r3801 72 72 DoubleValue alpha = AlphaParameter.ActualValue; 73 73 DoubleValue beta = BetaParameter.ActualValue; 74 var mainBranch = tree.Root.SubTrees[0].SubTrees[0]; 75 var scaledMainBranch = MakeSum(MakeProduct(beta.Value, mainBranch), alpha.Value); 74 if (alpha != null && beta != null) { 75 var mainBranch = tree.Root.SubTrees[0].SubTrees[0]; 76 var scaledMainBranch = MakeSum(MakeProduct(beta.Value, mainBranch), alpha.Value); 76 77 77 // remove the main branch before cloning to prevent cloning of sub-trees 78 tree.Root.SubTrees[0].RemoveSubTree(0); 79 var scaledTree = (SymbolicExpressionTree)tree.Clone(); 80 // insert main branch into the original tree again 81 tree.Root.SubTrees[0].InsertSubTree(0, mainBranch); 82 // insert the scaled main branch into the cloned tree 83 scaledTree.Root.SubTrees[0].InsertSubTree(0, scaledMainBranch); 84 ScaledSymbolicExpressionTreeParameter.ActualValue = scaledTree; 78 // remove the main branch before cloning to prevent cloning of sub-trees 79 tree.Root.SubTrees[0].RemoveSubTree(0); 80 var scaledTree = (SymbolicExpressionTree)tree.Clone(); 81 // insert main branch into the original tree again 82 tree.Root.SubTrees[0].InsertSubTree(0, mainBranch); 83 // insert the scaled main branch into the cloned tree 84 scaledTree.Root.SubTrees[0].InsertSubTree(0, scaledMainBranch); 85 ScaledSymbolicExpressionTreeParameter.ActualValue = scaledTree; 86 } else { 87 // alpha or beta parameter not available => do not scale tree 88 ScaledSymbolicExpressionTreeParameter.ActualValue = tree; 89 } 90 85 91 return base.Apply(); 86 92 }
Note: See TracChangeset
for help on using the changeset viewer.