Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/15 16:35:59 (10 years ago)
Author:
bburlacu
Message:

#1772: Updated genealogy graph view and worked on subtree sample count.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/BuildingBlockAnalyzers/SymbolicDataAnalysisPoly10Analyzer.cs

    r11493 r12283  
    4545    private const string BuildingBlocksFrequenciesTableName = "Building blocks frequencies";
    4646
    47 
    4847    // store evaluations of building blocks for phenotypic matching
    4948    private readonly Dictionary<string, List<double>> evaluationMap = new Dictionary<string, List<double>>();
     
    141140      var dataset = ProblemDataParameter.ActualValue.Dataset;
    142141      var rows = ProblemDataParameter.ActualValue.TrainingIndices.ToList();
    143       OnlineCalculatorError error;
    144       Dictionary<string, int> bbFrequencies = evaluationMap.Keys.ToDictionary(x => x, x => 0);
     142      var bbFrequencies = evaluationMap.Keys.ToDictionary(x => x, x => 0);
    145143
    146144      foreach (var key in evaluationMap.Keys) {
     
    154152            var s = nodes[i];
    155153            var values = interpreter.GetValues(s, dataset, rows);
     154            OnlineCalculatorError error;
    156155            var r2 = OnlinePearsonsRSquaredCalculator.Calculate(values, evaluationMap[key], out error);
    157156            if (error == OnlineCalculatorError.None && r2 >= PhenotypicSimilarityThreshold) {
     
    163162      }
    164163      var table = (DataTable)results[BuildingBlocksFrequenciesTableName].Value;
     164      double max = bbFrequencies.Max(x => x.Value);
    165165      foreach (var pair in bbFrequencies) {
     166        var formatter = new SymbolicExpressionTreeStringFormatter();
     167        //        var label = formatter.Format(fragmentMap[pair.Key]) + "(" + prettyLabels[pair.Key] + ")";
    166168        var label = prettyLabels[pair.Key];
    167         table.Rows[label].Values.Add(pair.Value);
     169        if (table.Rows.ContainsKey(label)) {
     170          var row = table.Rows[label];
     171          // scale previous values according to the new max
     172          //          if (row.Values.Count > 0) {
     173          //            var values = new List<double>(row.Values);
     174          //            var m = values.Max();
     175          //            row.Values.Replace(values.Select(x => x * m / max));
     176          //          }
     177          row.Values.Add(max > 0 ? pair.Value / max : 0);
     178        }
    168179      }
    169180
     
    227238      table.Rows.Clear();
    228239      foreach (var key in evaluationMap.Keys) {
    229         table.Rows.Add(new DataRow(prettyLabels[key]));
     240        table.Rows.Add(new DataRow(prettyLabels[key]) { VisualProperties = { StartIndexZero = true } });
    230241      }
    231242    }
Note: See TracChangeset for help on using the changeset viewer.