- Timestamp:
- 11/27/12 11:02:09 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic (added) merged: 8388,8391-8392,8395,8409,8915-8916,8935,8937
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Property svn:ignore
-
old new 1 *.user 2 Plugin.cs 1 3 bin 2 *.user3 HeuristicLabProblemsDataAnalysisSymbolicPlugin.cs4 4 obj 5 *.vs10x6 Plugin.cs
-
- Property svn:ignore
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r8895 r8946 140 140 <Compile Include="Crossovers\SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs" /> 141 141 <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionCrossover.cs" /> 142 <Compile Include="Interfaces\ISymbolicDataAnalysisImpactValuesCalculator.cs" /> 142 143 <Compile Include="Interpreter\InterpreterState.cs" /> 143 144 <Compile Include="Interpreter\OpCodes.cs" /> … … 164 165 <Compile Include="SymbolicDataAnalysisExpressionTreeSimplifier.cs" /> 165 166 <Compile Include="SymbolicDataAnalysisProblem.cs" /> 167 <Compile Include="SymbolicDataAnalysisSolutionImpactValuesCalculator.cs" /> 166 168 <Compile Include="Symbols\Addition.cs" /> 167 169 <Compile Include="Symbols\And.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisImpactValuesCalculator.cs
r8942 r8946 4 4 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 5 5 public interface ISymbolicDataAnalysisSolutionImpactValuesCalculator { 6 Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree, 7 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 8 IDataAnalysisProblemData problemData); 9 Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree, 10 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 11 IDataAnalysisProblemData problemData, 12 double lowerEstimationLimit, double upperEstimationLimit); 6 double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows); 7 double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN); 13 8 } 14 9 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Properties
- Property svn:ignore
--- +++
- Property svn:ignore
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs
r8942 r8946 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; … … 26 25 27 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 28 public abstract class SymbolicDataAnalysisSolutionImpactValuesCalculator { 29 public abstract IEnumerable<Tuple<ISymbolicExpressionTreeNode, double>> CalculateReplacementValues(ISymbolicExpressionTree tree, 30 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 31 IDataAnalysisProblemData problemData); 32 public abstract IEnumerable<Tuple<ISymbolicExpressionTreeNode, double>> CalculateImpactValues(ISymbolicExpressionTree tree, 33 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 34 IDataAnalysisProblemData problemData, 35 double lowerEstimationLimit, double upperEstimationLimit); 27 public abstract class SymbolicDataAnalysisSolutionImpactValuesCalculator : ISymbolicDataAnalysisSolutionImpactValuesCalculator { 28 public abstract double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows); 29 public abstract double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN); 36 30 37 protected static void SwitchNode(ISymbolicExpressionTreeNode root, ISymbolicExpressionTreeNode oldBranch, ISymbolicExpressionTreeNode newBranch) { 38 for (int i = 0; i < root.SubtreeCount; i++) { 39 if (root.GetSubtree(i) == oldBranch) { 40 root.RemoveSubtree(i); 41 root.InsertSubtree(i, newBranch); 42 return; 43 } 44 } 45 } 31 protected static double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 32 Dataset dataset, IEnumerable<int> rows) { 33 //optimization: constant nodes return always the same value 34 ConstantTreeNode constantNode = node as ConstantTreeNode; 35 if (constantNode != null) return constantNode.Value; 46 36 47 protected static double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree,48 ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData) {49 37 var rootSymbol = new ProgramRootSymbol().CreateTreeNode(); 50 38 var startSymbol = new StartSymbol().CreateTreeNode(); 51 39 rootSymbol.AddSubtree(startSymbol); 52 40 startSymbol.AddSubtree((ISymbolicExpressionTreeNode)node.Clone()); 53 var rows = problemData.TrainingIndices; 41 54 42 var tempTree = new SymbolicExpressionTree(rootSymbol); 55 return interpreter.GetSymbolicExpressionTreeValues(tempTree, problemData.Dataset, rows).Median(); 43 // clone ADFs of source tree 44 for (int i = 1; i < sourceTree.Root.SubtreeCount; i++) { 45 tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone()); 46 } 47 return interpreter.GetSymbolicExpressionTreeValues(tempTree, dataset, rows).Median(); 56 48 } 57 49 }
Note: See TracChangeset
for help on using the changeset viewer.