Ignore:
Timestamp:
07/15/13 16:33:13 (6 years ago)
Author:
ascheibe
Message:

#2031

  • added exponential fitting
  • added logarithmic fitting
  • refactored fitting code
  • updated license headers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs

    r9378 r9706  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929using HeuristicLab.MainForm;
    3030using HeuristicLab.Optimization;
     31using HeuristicLab.PluginInfrastructure;
    3132
    3233namespace HeuristicLab.Analysis.Statistics {
     
    4950      InitializeComponent();
    5051      stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick);
     52
     53      var fittingAlgs = ApplicationManager.Manager.GetInstances<IFitting>();
     54      foreach (var fit in fittingAlgs) {
     55        fittingComboBox.Items.Add(fit);
     56      }
     57      fittingComboBox.SelectedIndex = 0;
    5158    }
    5259
     
    137144        DataRow row = resTable.Rows[rowName];
    138145        var values = row.Values.ToArray();
    139         double k, d;
    140         LinearLeastSquaresFitting.Calculate(values, out k, out d);
    141 
    142         DataRow newRow = new DataRow(row.Name + " Fitted Line");
    143         for (int i = 0; i < values.Count(); i++) {
    144           newRow.Values.Add(k * i + d);
    145         }
     146
     147        var fittingAlg = fittingComboBox.SelectedItem as IFitting;
     148        DataRow newRow = fittingAlg.CalculateFittedLine(values, row.Name + " (" + fittingAlg.ToString() + ")");
    146149
    147150        if (!resTable.Rows.ContainsKey(newRow.Name))
     
    224227        double percentile75 = values.Percentile(0.75);
    225228        double k, d, r;
    226         LinearLeastSquaresFitting.Calculate(values.ToArray(), out k, out d);
    227         r = LinearLeastSquaresFitting.CalculateError(values.ToArray(), k, d);
     229        LinearLeastSquaresFitting llsf = new LinearLeastSquaresFitting();
     230        llsf.Calculate(values.ToArray(), out k, out d);
     231        r = llsf.CalculateError(values.ToArray(), k, d);
    228232        double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average();
    229233        double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average();
Note: See TracChangeset for help on using the changeset viewer.