Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/15 16:03:49 (10 years ago)
Author:
gkronber
Message:

#2283: changed handling of inverse expressions in transformation of expressions to canonical form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.SymbReg/SymbolicRegressionProblem.cs

    r12014 r12024  
    126126
    127127    public double Evaluate(string sentence) {
     128      var extender = new ExpressionExtender();
     129      sentence = extender.CanonicalRepresentation(sentence);
    128130      if (useConstantOpt)
    129131        return OptimizeConstantsAndEvaluate(sentence);
    130132      else {
    131         var extender = new ExpressionExtender();
    132133
    133134        Debug.Assert(SimpleEvaluate(sentence) == SimpleEvaluate(extender.CanonicalRepresentation(sentence)));
     
    152153
    153154    public IEnumerable<Feature> GetFeatures(string phrase) {
     155      // throw new NotImplementedException();
    154156      phrase = CanonicalRepresentation(phrase);
    155       return new Feature[] { new Feature(phrase, 1.0) };
     157      return phrase.Split('+').Distinct().Select(t => new Feature(t, 1.0));
     158      // return new Feature[] { new Feature(phrase, 1.0) };
    156159    }
    157160
Note: See TracChangeset for help on using the changeset viewer.