Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/12 13:20:38 (12 years ago)
Author:
bburlacu
Message:

#1772: New analyzer: SymbolicExpressionTreeRelativeLengthAnalyzer. Rewrote the SymbolicExpressionTreeFragmentsAnalyzer, added generic wrapper to wrap HL objects as items.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs

    r7479 r7997  
    147147        throw new ArgumentException("Cannot create trees of depth " + maxDepth + " or smaller because of grammar constraints.", "maxDepth");
    148148
    149 
    150149      int arity = seedNode.Grammar.GetMaximumSubtreeCount(seedNode.Symbol);
    151150      // Throw an exception if the seedNode happens to be a terminal, since in this case we cannot grow a tree.
     
    161160          .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i))
    162161          .ToList();
    163         var selectedSymbol = possibleSymbols.SelectRandom(random);
     162        var weights = possibleSymbols.Select(s => s.InitialFrequency);
     163        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    164164        var tree = selectedSymbol.CreateTreeNode();
    165165        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
     
    192192        if (!possibleSymbols.Any())
    193193          throw new InvalidOperationException("No symbols are available for the tree.");
    194 
    195         var selectedSymbol = possibleSymbols.SelectRandom(random);
     194        var weights = possibleSymbols.Select(s => s.InitialFrequency);
     195        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    196196        var tree = selectedSymbol.CreateTreeNode();
    197197        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
Note: See TracChangeset for help on using the changeset viewer.