Frage

I am using MathNet library to compute some statistics e.g.. median, min, max. I computed some histogram data using this code:

var histogram = new Histogram(data, numberOfBuckets);

What does the bucket number mean? Is it a probability which can be acquired? How can be the output of histogram which contain buckets processed to plot histogram chart? I think this output is really specific for plotting chart, e.g. in zedgraph. Buckets in histogram contains vector of buckets which looks like this: [1;1,4]=1.

War es hilfreich?

Lösung

The numberOfBuckets parameter say into how many equally-sized intervals should the range of data be split. Then histogram counts how many numbers from data fall into each bucket.

Try:

        var v = DenseVector.Create(10, i => i+1);
        Console.WriteLine(new Histogram(v, 5));

Maybe you want a histogram of natural numbers where each bucket contains the number of occurrences of a particular number (With some buckets possibly empty)? Then set numberOfBuckets to max-min+1.

Andere Tipps

The Histogram class has an indexer implemented that lets you access the internal buckets. So you can loop over the buckets to pull out each buckets stats.

Histogram h = new Histogram(myRandomSamples, numBuckets);

//Get data from 5th histogram bucket
double lb = h[5].LowerBound; //get the bucket low bound
double ub = h[5].UpperBound; //get the bucket upper bound
double count = h[5].Count;   //get number of samples in that histogram bucket
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top