- Timestamp:
- 05/21/14 14:16:54 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicExpressionTreeBacktransformator.cs
r10874 r10878 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 26 using HeuristicLab.Problems.DataAnalysis.Transformations; … … 46 47 .Where(n => n.VariableName == transformation.Column); 47 48 48 var transformationTree = transformationMapper.GenerateModel(transformation);49 49 foreach (var variableNode in variableNodes) { 50 // generate new subtrees because same subtree cannot be added more than once 51 var transformationTree = transformationMapper.GenerateModel(transformation); 50 52 SwapTransformationWithVariable(transformationTree, variableNode); 51 53 } … … 57 59 parent.RemoveSubtree(index); 58 60 61 if (!variableNode.Weight.IsAlmost(1.0)) { 62 transformationTree = CreateNodeFromWeight(transformationTree, variableNode); 63 } 64 65 parent.InsertSubtree(index, transformationTree); 66 } 67 68 private ISymbolicExpressionTreeNode CreateNodeFromWeight(ISymbolicExpressionTreeNode transformationTree, VariableTreeNode variableNode) { 59 69 var multiplicationNode = new SymbolicExpressionTreeNode(new Multiplication()); 60 70 multiplicationNode.AddSubtree(new ConstantTreeNode(new Constant()) { Value = variableNode.Weight }); 61 71 multiplicationNode.AddSubtree(transformationTree); 62 63 parent.InsertSubtree(index, multiplicationNode);72 transformationTree = multiplicationNode; 73 return transformationTree; 64 74 } 65 75 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TransformationToSymbolicTreeMapper.cs
r10872 r10878 273 273 } 274 274 275 private ISymbolicExpressionTreeNode CreateVariableTreeNode(string name, string description) {276 return new Variable (name, description).CreateTreeNode();275 private VariableTreeNode CreateVariableTreeNode(string name, string description) { 276 return new VariableTreeNode(new Variable(name, description)) { VariableName = name, Weight = 1.0 }; 277 277 } 278 278
Note: See TracChangeset
for help on using the changeset viewer.