Last change
on this file since 12966 was
7128,
checked in by epitzer, 13 years ago
|
#1696 Integrate fitness landscape analysis plugins from Heureka! repository.
|
File size:
1.3 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using HeuristicLab.Core;
|
---|
6 | using HeuristicLab.Optimization;
|
---|
7 | using HeuristicLab.Data;
|
---|
8 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
9 | using HeuristicLab.Common;
|
---|
10 | using HeuristicLab.Common.Resources;
|
---|
11 | using HeuristicLab.Analysis.FitnessLandscape.DataTables;
|
---|
12 | using System.Drawing;
|
---|
13 | using HeuristicLab.Analysis.FitnessLandscape.Analysis;
|
---|
14 |
|
---|
15 | namespace 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.