UNPKG

gnss_solutions

Version:

Javascript GNSS solution analysis library

119 lines (118 loc) 3.58 kB
import * as Immutable from "immutable"; import { TDigest } from "tdigest"; /** * Streaming, immutable histogram. Intended for use with categorical random * variables. * * Example: * ``` * let histogram = new acc.OnlineHistogram(); * histogram = histogram.update("foo"); * histogram = histogram.update("bar"); * console.log(histogram.getValue()); => {foo: 1, bar: 1}; * ``` */ export declare class OnlineHistogram { store: Immutable.Map<string, number>; name: string; /** * Construct an online histogram * * @param {string} name - Human readable name * @return {OnlineHistogram} - Constructed histogram */ constructor(name: string); /** * Set backing store from another histogram. * * @param {OnlineHistogram} obj - Histogram to copy * @return {OnlineHistogram} */ setStore(obj: OnlineHistogram): OnlineHistogram; /** * Update histogram, returning new histogram. * * @param {string} item - Categorical variable to update with * @return {OnlineHistogram} - New histogram */ update(item: string): OnlineHistogram; /** * Get the histogram. * * @return {Object} - Shallow copy of backing histogram */ getValue(): Object; } /** * Update a digest tracking quantiles, returning "new" t-digest. * * HACK (mookerji): Stop-gap HACK until we can do real immutable digest updates. * * @param {TDigest} digest - t-digest * @param {number} value - Value to update with * @return {TDigest} - "New" digest. */ export declare function updateDigest(digest: TDigest, value: number): TDigest; /** * Streaming, immutable statistical aggregator (i.e., quantile, min/max * calculator). Intended for use with calculating summaries of real random * variables: (approximate) quantiles, min/max, etc. * * Example: * ``` * let stats = new acc.OnlineStatistics(); * stats = stats.update(1); * stats = stats.update(2); * console.log(stats.getPercentiles([0.50])); => {"50" : 1.5} * ``` */ export declare class OnlineStatistics { store: TDigest; name: string; max: number; min: number; /** * Construct an online statistics object * * @param {string} name - Human readable name * @return {OnlineStatistics} - Constructed quantile object */ constructor(name: string); /** * Set backing store from another quantile object * * @param {OnlineStatistics} obj - Quantile object to copy * @return {OnlineStatistics} */ setStore(obj: OnlineStatistics): OnlineStatistics; /** * Update quantile calculator, returning new object. * * @param {number} item - Categorical variable to update * @return {OnlineStatistics} - New OnlineStatistics */ update(item: number): OnlineStatistics; /** * Get quantiles of underlying data. * * @param {Array<number> | number} percentiles - Percentile or list of * percentiles, with each element between 0 and 1. * @return {Object} Object of percentile values keyed by a string percentile * value. */ getPercentiles(p_or_plist: number | Array<number>): Object; /** * Return an approximate CDF of the underlying data * * @return {Object} Approximate CDF, with buckets from 0.1 to 0.9, 0.95, 0.99. */ getCDF(): Object; /** * @return {number} The current minimum. */ getMin(): number; /** * @return {number} The current maximum. */ getMax(): number; }