Free cookie consent management tool by TermsFeed Policy Generator

source: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape/Analysis/Aggregators/DistributionAnalyzer.cs @ 13365

Last change on this file since 13365 was 7128, checked in by epitzer, 13 years ago

#1696 Integrate fitness landscape analysis plugins from Heureka! repository.

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Core;
6using HeuristicLab.Optimization;
7using HeuristicLab.Data;
8using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
9using HeuristicLab.Common;
10using HeuristicLab.Common.Resources;
11using HeuristicLab.Analysis.FitnessLandscape.DataTables;
12using System.Drawing;
13using HeuristicLab.Analysis.FitnessLandscape.Analysis;
14
15namespace HeuristicLab.Analysis.FitnessLandscape {
16
17  public class DistributionAnalyzer {
18
19    private double[] values;
20
21    public DistributionAnalyzer(IEnumerable<double> values) {
22      this.values = values.ToArray();
23    }
24
25    public double Mean {
26      get {
27        try {
28          double mean = 0;
29          double variance = 0;
30          double skewness = 0;
31          double kurtosis = 0;
32          alglib.basestat.samplemoments(values, values.Length, ref mean, ref variance, ref skewness, ref kurtosis);
33          return mean;
34        } catch (Exception) {
35          return 0;
36        }
37      }
38    }
39
40    public double this[double quantile] {
41      get {
42        try {
43          double v = 0;
44          alglib.basestat.samplepercentile(values, values.Length, quantile, ref v);
45          return v;
46        } catch (Exception) {
47          return 0;
48        }
49      }
50    }
51  }
52}
Note: See TracBrowser for help on using the repository browser.