- Timestamp:
- 05/14/14 13:55:08 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TransformationToSymbolicTreeMapper.cs
r10846 r10848 38 38 return GenerateModelForLinearTransformation(); 39 39 } else if (transformation is ExponentialTransformation) { 40 40 return GenerateModelForExponentialTransformation(); 41 41 } else if (transformation is LogarithmicTransformation) { 42 42 … … 55 55 56 56 if (transformation is LinearTransformation) { 57 57 return GenerateInverseModelForLinearTransformation(); 58 58 } else if (transformation is ExponentialTransformation) { 59 59 return GenerateInverseModelForExponentialTransformation(); 60 60 } else if (transformation is LogarithmicTransformation) { 61 61 … … 75 75 private ISymbolicExpressionTree GenerateModelForLinearTransformation() { 76 76 var linearTransformation = (LinearTransformation)transformation; 77 var tree = CreateNewTree();78 string column = linearTransformation.Column;79 77 var kValue = linearTransformation.Multiplier; 80 78 var dValue = linearTransformation.Addend; … … 97 95 } 98 96 97 private ISymbolicExpressionTree GenerateInverseModelForLinearTransformation() { 98 var linearTransformation = (LinearTransformation)transformation; 99 var kValue = linearTransformation.Multiplier; 100 var dValue = linearTransformation.Addend; 101 102 // x - d 103 var substractionNode = new Subtraction().CreateTreeNode(); 104 var dNode = new ConstantTreeNode(new Constant() { Name = "d" }) { Value = dValue }; 105 var xNode = new Variable(column, "x").CreateTreeNode(); 106 substractionNode.AddSubtree(xNode); 107 substractionNode.AddSubtree(dNode); 108 109 // ( x - d ) / k 110 var divisionNode = new Division().CreateTreeNode(); 111 var kNode = new ConstantTreeNode(new Constant() { Name = "K" }) { Value = kValue }; 112 divisionNode.AddSubtree(substractionNode); 113 divisionNode.AddSubtree(kNode); 114 115 tree.Root.AddSubtree(divisionNode); 116 return tree; 117 } 118 119 120 private ISymbolicExpressionTree GenerateModelForExponentialTransformation() { 121 var exponentialTransformation = (ExponentialTransformation)transformation; 122 var bValue = exponentialTransformation.Base; 123 124 // b ^ x 125 var powerNode = new Power().CreateTreeNode(); 126 var bNode = new ConstantTreeNode(new Constant() { Name = "b" }) { Value = bValue }; 127 var xNode = new Variable(column, "x").CreateTreeNode(); 128 powerNode.AddSubtree(bNode); 129 powerNode.AddSubtree(xNode); 130 131 tree.Root.AddSubtree(powerNode); 132 return tree; 133 } 134 135 private ISymbolicExpressionTree GenerateInverseModelForExponentialTransformation() { 136 var exponentialTransformation = (ExponentialTransformation)transformation; 137 var bValue = exponentialTransformation.Base; 138 139 // log(x, b) 140 var logNode = new Logarithm().CreateTreeNode(); 141 var bNode = new ConstantTreeNode(new Constant() { Name = "b" }) { Value = bValue }; 142 var xNode = new Variable(column, "x").CreateTreeNode(); 143 logNode.AddSubtree(xNode); 144 logNode.AddSubtree(bNode); 145 146 tree.Root.AddSubtree(logNode); 147 return tree; 148 } 149 150 99 151 private ISymbolicExpressionTree CreateNewTree() { 100 152 return new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
Note: See TracChangeset
for help on using the changeset viewer.