Relatively low-level primitives on which to build higher-level math/stat functionality. Some are used internally, some are just things that may be useful to users of this library. This module is starting to take on the appearance of a small utility library.
Note: In several functions in this module that return arrays, the last parameter is an optional buffer for storing the return value. If this parameter is ommitted or the buffer is not large enough, one will be allocated on the GC heap.
This is the exception that is thrown on invalid arguments to a dstats function.
Finds the area under the ROC curve (a curve with sensitivity on the Y-axis and 1 - specificity on the X-axis). This is a useful metric for determining how well a test statistic discriminates between two classes. The following assumptions are made in this implementation:
Bins data into nbin equal width bins, indexed from 0 to nbin - 1, with 0 being the smallest bin, etc. The values returned are the bin index for each element.
Bins data into nbin equal width bins, indexed from 0 to nbin - 1, with 0 being the smallest bin, etc. The values returned are the counts for each bin.
Given a range of values and a range of categories, separates values by category. This function also guarantees that the order within each category will be maintained.
Special case implementation for when ElementType!C is boolean.
Create a Comb struct from a range or of a set of bounds.
Returns an associative array of counts of every element in input. Works w/ any iterable.
Bins data into nbin equal frequency bins, indexed from 0 to nbin - 1, with 0 being the smallest bin, etc. The values returned are the bin index for each element.
Log of (n choose k).
Create a Perm struct from a range or of a set of bounds.
Given an input array, outputs an array containing the rank from [1, input.length] corresponding to each element. Ties are dealt with by averaging. This function does not reorder the input range. Return type is float by default, but if you are sure you have no ties, ints can be used for efficiency (in which case ties will not be averaged), and if you need more precision when averaging ties, you can use double or real.
Same as rank(), but also sorts the input range. The array returned will still be identical to that returned by rank(), i.e. the rank of each element will correspond to the ranks of the elements in the input array before sorting.
Given a tuple possibly containing forward ranges, returns a tuple where save() has been called on all forward ranges.
Generates a sequence from start..end by increment. Includes start, excludes end. Does so eagerly as an array.
Converts a range with arbitrary element types (usually strings) to a range of reals lazily. Ignores any elements that could not be successfully converted. Useful for creating an input range that can be used with this lib out of a File without having to read the whole file into an array first. The advantages to this over just using std.algorithm.map are that it's less typing and that it ignores non-convertible elements, such as blank lines.
Generates every possible combination of r elements of the given sequence, or array indices from zero to N, depending on which c'tor is called. Uses an input range interface.
A struct that generates all possible permutations of a sequence.