Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/14 13:55:08 (11 years ago)
Author:
tsteinre
Message:
  • TransformationToSymbolicTreeMapper: added GenerateInverseModel[Inverse}Model for:
    • ExponentialTransformation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TransformationToSymbolicTreeMapper.cs

    r10846 r10848  
    3838        return GenerateModelForLinearTransformation();
    3939      } else if (transformation is ExponentialTransformation) {
    40 
     40        return GenerateModelForExponentialTransformation();
    4141      } else if (transformation is LogarithmicTransformation) {
    4242
     
    5555
    5656      if (transformation is LinearTransformation) {
    57 
     57        return GenerateInverseModelForLinearTransformation();
    5858      } else if (transformation is ExponentialTransformation) {
    59 
     59        return GenerateInverseModelForExponentialTransformation();
    6060      } else if (transformation is LogarithmicTransformation) {
    6161
     
    7575    private ISymbolicExpressionTree GenerateModelForLinearTransformation() {
    7676      var linearTransformation = (LinearTransformation)transformation;
    77       var tree = CreateNewTree();
    78       string column = linearTransformation.Column;
    7977      var kValue = linearTransformation.Multiplier;
    8078      var dValue = linearTransformation.Addend;
     
    9795    }
    9896
     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
    99151    private ISymbolicExpressionTree CreateNewTree() {
    100152      return new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
Note: See TracChangeset for help on using the changeset viewer.