Changeset 10869
- Timestamp:
- 05/21/14 11:49:55 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.cs
r10854 r10869 56 56 var mapper = new TransformationToSymbolicTreeMapper(); 57 57 var transformator = new SymbolicExpressionTreeBacktransformator(mapper); 58 var model = transformator.Backtransform(Content.Model, Content.ProblemData.Transformations); 59 MainFormManager.MainForm.ShowContent(model); 58 transformator.Backtransform(Content.Model, Content.ProblemData.Transformations); 60 59 } 61 60 } -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicExpressionTreeBacktransformator.cs
r10854 r10869 33 33 } 34 34 35 public IDataAnalysisModelBacktransform(IDataAnalysisModel model, IEnumerable<ITransformation> transformations) {35 public void Backtransform(IDataAnalysisModel model, IEnumerable<ITransformation> transformations) { 36 36 var symbolicModel = (ISymbolicDataAnalysisModel)model; 37 37 … … 39 39 ApplyBacktransformation(transformation, symbolicModel.SymbolicExpressionTree); 40 40 } 41 42 return symbolicModel;43 41 } 44 42 45 43 private void ApplyBacktransformation(ITransformation transformation, ISymbolicExpressionTree symbolicExpressionTree) { 46 bool modelHasVariable = symbolicExpressionTree.IterateNodesBreadth().Any(n => IsVariableNode(n, transformation.Column)); 47 // TODO 44 var variableNodes = symbolicExpressionTree.IterateNodesBreadth() 45 .Where(n => IsVariableNode(n, transformation.Column)); 46 47 var transformationTree = transformationMapper.GenerateModel(transformation); 48 foreach (var variableNode in variableNodes) { 49 SwapTransformationTree(transformationTree, variableNode); 50 } 51 } 52 53 private void SwapTransformationTree(ISymbolicExpressionTree transformationTree, ISymbolicExpressionTreeNode targetNode) { 54 var parent = targetNode.Parent; 55 int index = parent.IndexOfSubtree(targetNode); 56 parent.RemoveSubtree(index); 57 parent.InsertSubtree(index, transformationTree.Root.GetSubtree(0)); 48 58 } 49 59 -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TransformationToSymbolicTreeMapper.cs
r10866 r10869 284 284 285 285 private ConstantTreeNode CreateConstantTreeNode(string description, double value) { 286 return new ConstantTreeNode(new Constant() { Description = description }) { Value = value };286 return new ConstantTreeNode(new Constant()) { Value = value }; 287 287 } 288 288 private ISymbolicExpressionTreeNode CreateVariableTreeNode(string name, string description) { -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IModelBacktransformator.cs
r10854 r10869 25 25 namespace HeuristicLab.Problems.DataAnalysis { 26 26 public interface IModelBacktransformator { 27 IDataAnalysisModelBacktransform(IDataAnalysisModel model, IEnumerable<ITransformation> transformations);27 void Backtransform(IDataAnalysisModel model, IEnumerable<ITransformation> transformations); 28 28 } 29 29 }
Note: See TracChangeset
for help on using the changeset viewer.