Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/27/13 21:55:18 (12 years ago)
Author:
ascheibe
Message:

#1886 automatically calculate statistical values for each run

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs

    r9210 r9252  
    133133      Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem."));
    134134
    135       worseParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true);
    136       betterParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true);
    137       childDiversityToWorseParentHelper = new ScatterPlotHelper(false, true);
    138       childDiversityToBetterParentHelper = new ScatterPlotHelper(false, true);
    139       unwantedMutationsHelper = new ScatterPlotHelper(false, true);
    140       parentDiversityHelper = new ScatterPlotHelper(false, true);
    141       parentQualityHelper = new ScatterPlotHelper(false, true, true);
     135      worseParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true, true);
     136      betterParentCrossoverPerformancePlot = new ScatterPlotHelper(false, true, true, true);
     137      childDiversityToWorseParentHelper = new ScatterPlotHelper(false, true, false, true);
     138      childDiversityToBetterParentHelper = new ScatterPlotHelper(false, true, false, true);
     139      unwantedMutationsHelper = new ScatterPlotHelper(false, true, false, true);
     140      parentDiversityHelper = new ScatterPlotHelper(false, true, false, true);
     141      parentQualityHelper = new ScatterPlotHelper(false, true, true, true);
    142142      successHelper = new DataTableHelper();
    143143      equalParentsHelper = new DataTableHelper();
     
    320320      parentQualityHelper.CleanUp();
    321321      unwantedMutationsHelper.CleanUp();
     322      successHelper.CleanUpAndCompressData();
     323      equalParentsHelper.CleanUpAndCompressData();
    322324    }
    323325  }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/DataTableHelper.cs

    r9059 r9252  
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Collections;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     26using HeuristicLab.Data;
    2527using HeuristicLab.Optimization;
    2628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    7981      return dt.Rows[dataRowNames[0]].Values;
    8082    }
     83
     84    public void CleanUp() {
     85      //remove chart
     86      resultsCol[chartName].Value = null;
     87      resultsCol.Remove(chartName);
     88      dt = null;
     89    }
     90
     91    public void CleanUpAndCompressData() {
     92      string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", "Gradient", "Relative Error", "Avg. of Upper 25 %", " Avg. of Lower 25 %", "Avg. of First 25 %", "Avg. of Last 25 %" };
     93
     94      foreach (string rowName in dataRowNames) {
     95        DataRow curDataRow = dt.Rows[rowName];
     96        var values = curDataRow.Values.AsEnumerable();
     97
     98        double cnt = values.Count();
     99        double min = values.Min();
     100        double max = values.Max();
     101        double avg = values.Average();
     102        double median = values.Median();
     103        double stdDev = values.StandardDeviation();
     104        double variance = values.Variance();
     105        double percentile25 = values.Percentile(0.25);
     106        double percentile75 = values.Percentile(0.75);
     107        double k, d, r;
     108        LinearLeastSquaresFitting.Calculate(values.ToArray(), out k, out d);
     109        r = LinearLeastSquaresFitting.CalculateError(values.ToArray(), k, d);
     110        double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average();
     111        double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average();
     112        double firstAvg = values.Take((int)(values.Count() * 0.25)).Average();
     113        double lastAvg = values.Skip((int)(values.Count() * 0.75)).Average();
     114
     115        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[0], new DoubleValue(cnt)));
     116        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[1], new DoubleValue(min)));
     117        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[2], new DoubleValue(max)));
     118        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[3], new DoubleValue(avg)));
     119        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[4], new DoubleValue(median)));
     120        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[5], new DoubleValue(stdDev)));
     121        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[6], new DoubleValue(variance)));
     122        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[7], new DoubleValue(percentile25)));
     123        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[8], new DoubleValue(percentile75)));
     124        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[9], new DoubleValue(k)));
     125        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[10], new DoubleValue(r)));
     126        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[11], new DoubleValue(upperAvg)));
     127        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[12], new DoubleValue(lowerAvg)));
     128        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[13], new DoubleValue(firstAvg)));
     129        resultsCol.Add(new Result(chartName + " " + rowName + " " + columnNames[14], new DoubleValue(lastAvg)));
     130      }
     131
     132      CleanUp();
     133    }
    81134  }
    82135}
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs

    r9185 r9252  
    120120      Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem."));
    121121
    122       diversityPlotHelper = new ScatterPlotHelper(false, true);
    123       qualityPlotHelper = new ScatterPlotHelper(false, true, true);
     122      diversityPlotHelper = new ScatterPlotHelper(false, true, false, true);
     123      qualityPlotHelper = new ScatterPlotHelper(false, true, true, true);
    124124      successHelper = new DataTableHelper();
    125125    }
     
    203203      qualityPlotHelper.CleanUp();
    204204      diversityPlotHelper.CleanUp();
     205      successHelper.CleanUpAndCompressData();
    205206    }
    206207
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ScatterPlotHelper.cs

    r9185 r9252  
    5151    private bool trackMinMaxValues;
    5252    [Storable]
     53    private bool compressData;
     54    [Storable]
    5355    private double min;
    5456    public double Min {
     
    8183      min = original.min;
    8284      max = original.max;
     85      compressData = original.compressData;
    8386
    8487      chartName = original.chartName;
     
    9497      min = double.MaxValue;
    9598      max = double.MinValue;
     99      compressData = false;
    96100    }
    97101
    98     public ScatterPlotHelper(bool storeHistory, bool createDataTable, bool trackMinMax = false)
     102    public ScatterPlotHelper(bool storeHistory, bool createDataTable, bool trackMinMax = false, bool compress = false)
    99103      : base() {
    100104      StoreHistory = storeHistory;
    101105      CreateDataTable = createDataTable;
    102106      trackMinMaxValues = trackMinMax;
     107      compressData = compress;
    103108      min = double.MaxValue;
    104109      max = double.MinValue;
     
    170175        minMaxDataTableHelper.InitializeChart(Results, chartName + " Scaled Chart", new string[] { yAxisTitle });
    171176        dataTableHelper.GetFirstDataRow().ForEach(x => minMaxDataTableHelper.AddPoint((x - min) / (max - min)));
     177
     178        dataTableHelper.CleanUp(); //just use the scaled chart and remove the original
     179
     180        if (compressData) {
     181          minMaxDataTableHelper.CleanUpAndCompressData();
     182        }
     183      }
     184
     185      if (CreateDataTable && compressData && !trackMinMaxValues) {
     186        dataTableHelper.CleanUpAndCompressData();
    172187      }
    173188
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/SolutionToPopulationAnalyzer.cs

    r9196 r9252  
    108108      Parameters.Add(new LookupParameter<DoubleValue>("WorstKnownQuality", "The quality of the worst known solution of this problem."));
    109109
    110       populationDiversityPlot = new ScatterPlotHelper(false, true);
    111       populationQualityPlot = new ScatterPlotHelper(false, true, true);
    112       qualityPlot = new ScatterPlotHelper(false, true, true);
     110      populationDiversityPlot = new ScatterPlotHelper(false, true, false, true);
     111      populationQualityPlot = new ScatterPlotHelper(false, true, true, true);
     112      qualityPlot = new ScatterPlotHelper(false, true, true, true);
    113113    }
    114114
Note: See TracChangeset for help on using the changeset viewer.