Last change
on this file since 17607 was
16995,
checked in by gkronber, 6 years ago
|
#2520 Update plugin dependencies and references for HL.FLA for new persistence
|
File size:
1002 bytes
|
Rev | Line | |
---|
[7128] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 |
|
---|
| 5 | namespace HeuristicLab.Analysis.FitnessLandscape {
|
---|
| 6 |
|
---|
| 7 | public class DistributionAnalyzer {
|
---|
| 8 |
|
---|
| 9 | private double[] values;
|
---|
| 10 |
|
---|
| 11 | public DistributionAnalyzer(IEnumerable<double> values) {
|
---|
| 12 | this.values = values.ToArray();
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public double Mean {
|
---|
| 16 | get {
|
---|
| 17 | try {
|
---|
| 18 | double mean = 0;
|
---|
| 19 | double variance = 0;
|
---|
| 20 | double skewness = 0;
|
---|
| 21 | double kurtosis = 0;
|
---|
| 22 | alglib.basestat.samplemoments(values, values.Length, ref mean, ref variance, ref skewness, ref kurtosis);
|
---|
| 23 | return mean;
|
---|
| 24 | } catch (Exception) {
|
---|
| 25 | return 0;
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public double this[double quantile] {
|
---|
| 31 | get {
|
---|
| 32 | try {
|
---|
| 33 | double v = 0;
|
---|
| 34 | alglib.basestat.samplepercentile(values, values.Length, quantile, ref v);
|
---|
| 35 | return v;
|
---|
| 36 | } catch (Exception) {
|
---|
| 37 | return 0;
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.