OEFPHistogram
class OEFPHistogram
The OEFPHistogram class is used to hold a histogram of similarity scores.
This class is an efficient way to obtain statistics on large databases which would be unfeasible to keep as full NxN similarity matrices.
- The following classes derive from this class:
See also
Constructors
OEFPHistogram(numBins: int = 200, min: float = 0.0,
max: float = 1.0) -> OEFPHistogram
OEFPHistogram(arg2: OEFPHistogram) -> OEFPHistogram
Creates an OEFPHistogram object with given number of bins and range.
- nrbins
Number of bins in the histogram. (default=200)
- min
Minimum bound (inclusive) of the histogram range. (default = 0.0)
- max
Maximum bound (inclusive) of the histogram range. (default = 1.0)
Note
The default range of [0,1] covers all built-in similarity measures.
AddSample
AddSample(sample: float) -> int
Adds the sample into the histogram by incrementing the count in the relevant bin. Returns the bin index that the sample went into.
GetBinBoundaries
GetBinBoundaries() -> Iterable[float]
Returns an iterator over the boundaries for each bin.
Note
The number of elements in this iterator is equal to
OEFPHistogram.NumBins +1.
GetBinCenters
GetBinCenters() -> Iterable[float]
Returns an iterator over the center value for each bin.
Note
The number of elements in this iterator is equal to
OEFPHistogram.NumBins.
Hint
It is generally reasonable to plot the results of
OEFPHistogram.GetCounts or
OEFPHistogram.GetDensity against the bin centers
returned by this method.
GetBinIdx
GetBinIdx(sample: float) -> int
Returns the bin index that the sample would go into without actually adding the sample into the bin.
GetBinWidth
GetBinWidth() -> float
Returns the width of bins in the histogram.
GetCounts
GetCounts() -> Iterable[int]
Returns an iterator over the bin counts.
Note
Even though counts are returned as unsigned integers, they are internally
kept as size_t. If the counts are overflowing the unsigned int type of
the system, it may be more appropriate to use the normalized
OEFPHistogram.GetDensity instead.
GetDensity
GetDensity() -> Iterable[float]
Returns an iterator over the probability density for each bin.
Note
Result is equivalent to OEFPHistogram.GetCounts
normalized by OEFPHistogram.NumSamples.
GetMax
GetMax() -> float
Returns upper bound (inclusive) of the histogram range.
GetMin
GetMin() -> float
Returns lower bound (inclusive) of the histogram range.
Mean
Mean() -> float
Approximates and returns the sample mean over the histogram.
Note
This approximation is affected by number of bins in the histogram.
NumBins
NumBins() -> int
Returns the number of bins in the histogram.
NumSamples
NumSamples() -> int
Returns the total number of samples in the histogram.
Std
Std() -> float
Approximates and returns the sample standard deviation over the histogram.
Note
This approximation is affected by number of bins in the histogram.