Changeset 12014 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.SymbReg/SymbolicRegressionProblem.cs
- Timestamp:
- 02/16/15 09:14:38 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.SymbReg/SymbolicRegressionProblem.cs
r11981 r12014 9 9 using System.Text; 10 10 using AutoDiff; 11 using HeuristicLab.Algorithms.Bandits; 11 12 using HeuristicLab.Common; 12 13 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 128 129 return OptimizeConstantsAndEvaluate(sentence); 129 130 else { 131 var extender = new ExpressionExtender(); 132 133 Debug.Assert(SimpleEvaluate(sentence) == SimpleEvaluate(extender.CanonicalRepresentation(sentence))); 130 134 return SimpleEvaluate(sentence); 131 135 } … … 143 147 144 148 public string CanonicalRepresentation(string phrase) { 145 return phrase; 149 var extender = new ExpressionExtender(); 150 return extender.CanonicalRepresentation(phrase); 146 151 } 147 152 148 153 public IEnumerable<Feature> GetFeatures(string phrase) { 149 // first generate canonical expression (which must not contain ()) 150 // recursively split into expressions 151 // for each expression split into terms 152 // for each term order factors to canonical // ../E = * 1/E 154 phrase = CanonicalRepresentation(phrase); 153 155 return new Feature[] { new Feature(phrase, 1.0) }; 154 156 }
Note: See TracChangeset
for help on using the changeset viewer.