@ac-kit/math-stats 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +205 -0
- package/README.md +86 -6
- package/dist/_digamma.d.ts +10 -0
- package/dist/_digamma.d.ts.map +1 -0
- package/dist/_digamma.js +38 -0
- package/dist/_digamma.js.map +1 -0
- package/dist/_dilogarithm.d.ts +14 -0
- package/dist/_dilogarithm.d.ts.map +1 -0
- package/dist/_dilogarithm.js +77 -0
- package/dist/_dilogarithm.js.map +1 -0
- package/dist/_histogram-rules.d.ts +15 -0
- package/dist/_histogram-rules.d.ts.map +1 -0
- package/dist/_histogram-rules.js +208 -0
- package/dist/_histogram-rules.js.map +1 -0
- package/dist/_incomplete-gamma-shape-derivative.d.ts +17 -0
- package/dist/_incomplete-gamma-shape-derivative.d.ts.map +1 -0
- package/dist/_incomplete-gamma-shape-derivative.js +90 -0
- package/dist/_incomplete-gamma-shape-derivative.js.map +1 -0
- package/dist/_logistic.d.ts +14 -0
- package/dist/_logistic.d.ts.map +1 -0
- package/dist/_logistic.js +29 -0
- package/dist/_logistic.js.map +1 -0
- package/dist/_normal-tail.d.ts +43 -0
- package/dist/_normal-tail.d.ts.map +1 -0
- package/dist/_normal-tail.js +124 -0
- package/dist/_normal-tail.js.map +1 -0
- package/dist/_rank-test.d.ts +71 -0
- package/dist/_rank-test.d.ts.map +1 -0
- package/dist/_rank-test.js +130 -0
- package/dist/_rank-test.js.map +1 -0
- package/dist/average.js +2 -2
- package/dist/average.js.map +1 -1
- package/dist/bootstrap.d.ts +67 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +154 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/censored-logistic-distribution.d.ts +23 -0
- package/dist/censored-logistic-distribution.d.ts.map +1 -0
- package/dist/censored-logistic-distribution.js +63 -0
- package/dist/censored-logistic-distribution.js.map +1 -0
- package/dist/censored-shifted-gamma-distribution.d.ts +23 -0
- package/dist/censored-shifted-gamma-distribution.d.ts.map +1 -0
- package/dist/censored-shifted-gamma-distribution.js +73 -0
- package/dist/censored-shifted-gamma-distribution.js.map +1 -0
- package/dist/confidence-interval.d.ts +53 -0
- package/dist/confidence-interval.d.ts.map +1 -1
- package/dist/confidence-interval.js +73 -0
- package/dist/confidence-interval.js.map +1 -1
- package/dist/correlation.d.ts +41 -0
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +168 -2
- package/dist/correlation.js.map +1 -1
- package/dist/descriptive.d.ts +129 -0
- package/dist/descriptive.d.ts.map +1 -0
- package/dist/descriptive.js +289 -0
- package/dist/descriptive.js.map +1 -0
- package/dist/forecast/_forecast-checks.d.ts +30 -0
- package/dist/forecast/_forecast-checks.d.ts.map +1 -0
- package/dist/forecast/_forecast-checks.js +119 -0
- package/dist/forecast/_forecast-checks.js.map +1 -0
- package/dist/forecast/_score-kernels.d.ts +63 -0
- package/dist/forecast/_score-kernels.d.ts.map +1 -0
- package/dist/forecast/_score-kernels.js +264 -0
- package/dist/forecast/_score-kernels.js.map +1 -0
- package/dist/forecast/brier-score.d.ts +102 -0
- package/dist/forecast/brier-score.d.ts.map +1 -0
- package/dist/forecast/brier-score.js +163 -0
- package/dist/forecast/brier-score.js.map +1 -0
- package/dist/forecast/crps-closed-form.d.ts +64 -0
- package/dist/forecast/crps-closed-form.d.ts.map +1 -0
- package/dist/forecast/crps-closed-form.js +106 -0
- package/dist/forecast/crps-closed-form.js.map +1 -0
- package/dist/forecast/crps-ensemble.d.ts +53 -0
- package/dist/forecast/crps-ensemble.d.ts.map +1 -0
- package/dist/forecast/crps-ensemble.js +121 -0
- package/dist/forecast/crps-ensemble.js.map +1 -0
- package/dist/forecast/emos.d.ts +158 -0
- package/dist/forecast/emos.d.ts.map +1 -0
- package/dist/forecast/emos.js +397 -0
- package/dist/forecast/emos.js.map +1 -0
- package/dist/forecast/exceedance-probability.d.ts +54 -0
- package/dist/forecast/exceedance-probability.d.ts.map +1 -0
- package/dist/forecast/exceedance-probability.js +125 -0
- package/dist/forecast/exceedance-probability.js.map +1 -0
- package/dist/forecast/log-score.d.ts +18 -0
- package/dist/forecast/log-score.d.ts.map +1 -0
- package/dist/forecast/log-score.js +19 -0
- package/dist/forecast/log-score.js.map +1 -0
- package/dist/forecast/logistic-regression.d.ts +123 -0
- package/dist/forecast/logistic-regression.d.ts.map +1 -0
- package/dist/forecast/logistic-regression.js +282 -0
- package/dist/forecast/logistic-regression.js.map +1 -0
- package/dist/forecast/rank-histogram.d.ts +32 -0
- package/dist/forecast/rank-histogram.d.ts.map +1 -0
- package/dist/forecast/rank-histogram.js +63 -0
- package/dist/forecast/rank-histogram.js.map +1 -0
- package/dist/forecast/reliability-diagram.d.ts +70 -0
- package/dist/forecast/reliability-diagram.d.ts.map +1 -0
- package/dist/forecast/reliability-diagram.js +126 -0
- package/dist/forecast/reliability-diagram.js.map +1 -0
- package/dist/forecast/roc-curve.d.ts +58 -0
- package/dist/forecast/roc-curve.d.ts.map +1 -0
- package/dist/forecast/roc-curve.js +124 -0
- package/dist/forecast/roc-curve.js.map +1 -0
- package/dist/hierarchical-cluster.d.ts.map +1 -1
- package/dist/hierarchical-cluster.js +10 -5
- package/dist/hierarchical-cluster.js.map +1 -1
- package/dist/histogram-edges.d.ts +92 -0
- package/dist/histogram-edges.d.ts.map +1 -0
- package/dist/histogram-edges.js +325 -0
- package/dist/histogram-edges.js.map +1 -0
- package/dist/histogram.d.ts +55 -21
- package/dist/histogram.d.ts.map +1 -1
- package/dist/histogram.js +56 -83
- package/dist/histogram.js.map +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/kmeans.d.ts.map +1 -1
- package/dist/kmeans.js +11 -6
- package/dist/kmeans.js.map +1 -1
- package/dist/kmedoids.js +2 -1
- package/dist/kmedoids.js.map +1 -1
- package/dist/mann-whitney-u.d.ts +27 -0
- package/dist/mann-whitney-u.d.ts.map +1 -0
- package/dist/mann-whitney-u.js +94 -0
- package/dist/mann-whitney-u.js.map +1 -0
- package/dist/multiple-regression.d.ts +123 -0
- package/dist/multiple-regression.d.ts.map +1 -0
- package/dist/multiple-regression.js +208 -0
- package/dist/multiple-regression.js.map +1 -0
- package/dist/principal-components.d.ts +66 -0
- package/dist/principal-components.d.ts.map +1 -0
- package/dist/principal-components.js +105 -0
- package/dist/principal-components.js.map +1 -0
- package/dist/quantile.d.ts +113 -5
- package/dist/quantile.d.ts.map +1 -1
- package/dist/quantile.js +318 -19
- package/dist/quantile.js.map +1 -1
- package/dist/regression.d.ts +46 -0
- package/dist/regression.d.ts.map +1 -1
- package/dist/regression.js +99 -1
- package/dist/regression.js.map +1 -1
- package/dist/running-statistics.d.ts +103 -0
- package/dist/running-statistics.d.ts.map +1 -0
- package/dist/running-statistics.js +283 -0
- package/dist/running-statistics.js.map +1 -0
- package/dist/sample.d.ts +29 -0
- package/dist/sample.d.ts.map +1 -0
- package/dist/sample.js +39 -0
- package/dist/sample.js.map +1 -0
- package/dist/t-digest.d.ts +136 -0
- package/dist/t-digest.d.ts.map +1 -0
- package/dist/t-digest.js +424 -0
- package/dist/t-digest.js.map +1 -0
- package/dist/truncated-normal-distribution.d.ts +28 -0
- package/dist/truncated-normal-distribution.d.ts.map +1 -0
- package/dist/truncated-normal-distribution.js +198 -0
- package/dist/truncated-normal-distribution.js.map +1 -0
- package/dist/wilcoxon-signed-rank.d.ts +42 -0
- package/dist/wilcoxon-signed-rank.d.ts.map +1 -0
- package/dist/wilcoxon-signed-rank.js +117 -0
- package/dist/wilcoxon-signed-rank.js.map +1 -0
- package/package.json +14 -10
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { bisectRightNumbers } from "@ac-kit/algo";
|
|
2
|
+
import { assertInteger, describeValue } from "@ac-kit/core";
|
|
3
|
+
import { writeQuantile } from "../quantile.js";
|
|
4
|
+
import { assertBinary_, assertProbabilities_, assertSameLength_, probabilityBins_, weightTotal_, } from "./_forecast-checks.js";
|
|
5
|
+
/**
|
|
6
|
+
* The reliability diagram of probability forecasts against binary outcomes
|
|
7
|
+
* (Murphy and Winkler 1977): for each bin, the mean forecast probability
|
|
8
|
+
* against the observed frequency of the event, which lie on the diagonal for
|
|
9
|
+
* reliable forecasts. Columnar: one `Float64Array` per quantity.
|
|
10
|
+
*
|
|
11
|
+
* **Consistency bars** (Bröcker and Smith 2007) show how far from the diagonal
|
|
12
|
+
* a reliable forecast's points still stray by chance, given how few cases each
|
|
13
|
+
* bin holds. Each surrogate data set redraws `n` forecasts from the given ones
|
|
14
|
+
* (by their weights) and each outcome as a Bernoulli trial of its own forecast
|
|
15
|
+
* — reliable by construction — and records, per bin, the observed frequency
|
|
16
|
+
* minus the mean forecast. A bar is the bin's mean forecast plus the `(1 ±
|
|
17
|
+
* level)/2` quantiles of that deviation, so it surrounds the diagonal at the
|
|
18
|
+
* point's abscissa; a point outside its bar is evidence of miscalibration at
|
|
19
|
+
* that level.
|
|
20
|
+
*
|
|
21
|
+
* O(n log n + resamples · n log n) time (one binary search per weighted draw),
|
|
22
|
+
* O(bins · resamples) memory.
|
|
23
|
+
*
|
|
24
|
+
* @param probabilities The forecast probabilities, in `[0, 1]`.
|
|
25
|
+
* @param outcomes The binary outcomes, `0` or `1`.
|
|
26
|
+
* @param options Binning, case weights, consistency resampling.
|
|
27
|
+
* @returns The diagram's columns.
|
|
28
|
+
* @throws {RangeError} When the lengths differ, a probability lies outside `[0,
|
|
29
|
+
* 1]`, an outcome is not `0` or `1`, or an option is out of range.
|
|
30
|
+
*/
|
|
31
|
+
export function reliabilityDiagram(probabilities, outcomes, options) {
|
|
32
|
+
const routine = "reliabilityDiagram";
|
|
33
|
+
const count = probabilities.length;
|
|
34
|
+
assertSameLength_(routine, "probabilities", count, "outcomes", outcomes.length);
|
|
35
|
+
assertProbabilities_(routine, probabilities);
|
|
36
|
+
assertBinary_(routine, outcomes);
|
|
37
|
+
const weights = options?.weights ?? null;
|
|
38
|
+
const total = weightTotal_(routine, weights, count);
|
|
39
|
+
const bins = probabilityBins_(routine, options?.bins ?? 10, probabilities);
|
|
40
|
+
const binCount = bins.count;
|
|
41
|
+
const weight = new Float64Array(binCount);
|
|
42
|
+
const meanForecast = new Float64Array(binCount);
|
|
43
|
+
const observedFrequency = new Float64Array(binCount);
|
|
44
|
+
const consistencyLower = new Float64Array(binCount).fill(Number.NaN);
|
|
45
|
+
const consistencyUpper = new Float64Array(binCount).fill(Number.NaN);
|
|
46
|
+
const binOf = new Int32Array(count);
|
|
47
|
+
for (let index = 0; index < count; index++) {
|
|
48
|
+
const caseWeight = weights === null ? 1 : weights[index];
|
|
49
|
+
const bin = bins.binOf(probabilities[index]);
|
|
50
|
+
binOf[index] = bin;
|
|
51
|
+
weight[bin] += caseWeight;
|
|
52
|
+
meanForecast[bin] += caseWeight * probabilities[index];
|
|
53
|
+
observedFrequency[bin] += caseWeight * outcomes[index];
|
|
54
|
+
}
|
|
55
|
+
for (let bin = 0; bin < binCount; bin++) {
|
|
56
|
+
meanForecast[bin] /= weight[bin];
|
|
57
|
+
observedFrequency[bin] /= weight[bin];
|
|
58
|
+
}
|
|
59
|
+
const consistency = options?.consistency ?? null;
|
|
60
|
+
if (consistency !== null && count > 0) {
|
|
61
|
+
const resamples = consistency.resamples ?? 1000;
|
|
62
|
+
const level = consistency.level ?? 0.9;
|
|
63
|
+
assertInteger(resamples, "resamples", 1);
|
|
64
|
+
if (!(level > 0 && level < 1)) {
|
|
65
|
+
throw new RangeError(`${routine}: level must be in (0, 1), got ${describeValue(level)}`);
|
|
66
|
+
}
|
|
67
|
+
const random = consistency.random;
|
|
68
|
+
// Cumulative weights, to draw a case in proportion to its weight.
|
|
69
|
+
const cumulative = new Float64Array(count);
|
|
70
|
+
let running = 0;
|
|
71
|
+
for (let index = 0; index < count; index++) {
|
|
72
|
+
running += weights === null ? 1 : weights[index];
|
|
73
|
+
cumulative[index] = running;
|
|
74
|
+
}
|
|
75
|
+
const deviations = new Float64Array(binCount * resamples);
|
|
76
|
+
const filled = new Int32Array(binCount);
|
|
77
|
+
const drawnWeight = new Float64Array(binCount);
|
|
78
|
+
const drawnForecast = new Float64Array(binCount);
|
|
79
|
+
const drawnEvents = new Float64Array(binCount);
|
|
80
|
+
for (let resample = 0; resample < resamples; resample++) {
|
|
81
|
+
drawnWeight.fill(0);
|
|
82
|
+
drawnForecast.fill(0);
|
|
83
|
+
drawnEvents.fill(0);
|
|
84
|
+
for (let draw = 0; draw < count; draw++) {
|
|
85
|
+
const chosen = Math.min(bisectRightNumbers(cumulative, random() * total), count - 1);
|
|
86
|
+
const forecast = probabilities[chosen];
|
|
87
|
+
const bin = binOf[chosen];
|
|
88
|
+
drawnWeight[bin] += 1;
|
|
89
|
+
drawnForecast[bin] += forecast;
|
|
90
|
+
if (random() < forecast) {
|
|
91
|
+
drawnEvents[bin] += 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (let bin = 0; bin < binCount; bin++) {
|
|
95
|
+
const drawn = drawnWeight[bin];
|
|
96
|
+
if (drawn > 0) {
|
|
97
|
+
deviations[bin * resamples + filled[bin]] =
|
|
98
|
+
(drawnEvents[bin] - drawnForecast[bin]) / drawn;
|
|
99
|
+
filled[bin] += 1;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const tail = (1 - level) / 2;
|
|
104
|
+
for (let bin = 0; bin < binCount; bin++) {
|
|
105
|
+
const from = bin * resamples;
|
|
106
|
+
const to = from + filled[bin];
|
|
107
|
+
if (to > from && weight[bin] > 0) {
|
|
108
|
+
deviations.subarray(from, to).sort();
|
|
109
|
+
writeQuantile(consistencyLower, bin, deviations, tail, from, to);
|
|
110
|
+
writeQuantile(consistencyUpper, bin, deviations, 1 - tail, from, to);
|
|
111
|
+
consistencyLower[bin] += meanForecast[bin];
|
|
112
|
+
consistencyUpper[bin] += meanForecast[bin];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
binLower: bins.lower,
|
|
118
|
+
binUpper: bins.upper,
|
|
119
|
+
weight,
|
|
120
|
+
meanForecast,
|
|
121
|
+
observedFrequency,
|
|
122
|
+
consistencyLower,
|
|
123
|
+
consistencyUpper,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=reliability-diagram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reliability-diagram.js","sourceRoot":"","sources":["../../src/forecast/reliability-diagram.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAiB,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACN,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAiD/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,kBAAkB,CACjC,aAAgC,EAChC,QAA2B,EAC3B,OAAmC;IAEnC,MAAM,OAAO,GAAG,oBAAoB,CAAC;IACrC,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC;IAEnC,iBAAiB,CAChB,OAAO,EACP,eAAe,EACf,KAAK,EACL,UAAU,EACV,QAAQ,CAAC,MAAM,CACf,CAAC;IACF,oBAAoB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC7C,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjC,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;IACzC,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,IAAI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
+
* A relative operating characteristic (ROC) curve, columnar: point `j` is the
|
|
4
|
+
* warning rule "the event when the probability is at least `thresholds[j]`".
|
|
5
|
+
* The first point, at threshold `+∞`, warns never (`0, 0`); the last, at the
|
|
6
|
+
* lowest forecast, always (`1, 1`).
|
|
7
|
+
*/
|
|
8
|
+
export type RocCurve = {
|
|
9
|
+
/**
|
|
10
|
+
* The decision thresholds, descending: `+∞`, then each distinct forecast (or
|
|
11
|
+
* the given thresholds, then `−∞`).
|
|
12
|
+
*/
|
|
13
|
+
readonly thresholds: Float64Array;
|
|
14
|
+
/** The hit rate (probability of detection) of each rule. */
|
|
15
|
+
readonly hitRate: Float64Array;
|
|
16
|
+
/** The false alarm rate (probability of false detection) of each rule. */
|
|
17
|
+
readonly falseAlarmRate: Float64Array;
|
|
18
|
+
/**
|
|
19
|
+
* The area under the curve by the trapezoidal rule: the probability that a
|
|
20
|
+
* random event got a higher forecast than a random non-event, ties counting
|
|
21
|
+
* half (the Mann–Whitney statistic). `0.5` is no discrimination; `NaN`
|
|
22
|
+
* without both events and non-events.
|
|
23
|
+
*/
|
|
24
|
+
readonly area: number;
|
|
25
|
+
};
|
|
26
|
+
/** Options of {@link rocCurve}. */
|
|
27
|
+
export type RocCurveOptions = ForecastWeightsOptions & {
|
|
28
|
+
/**
|
|
29
|
+
* The decision thresholds, distinct and not `NaN`, in any order: the curve
|
|
30
|
+
* then has a point at `+∞`, one per threshold (descending) and one at `−∞`.
|
|
31
|
+
* `null` or absent: every distinct forecast value (the empirical curve).
|
|
32
|
+
*/
|
|
33
|
+
readonly thresholds?: ArrayLike<number> | null;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The ROC curve of probability forecasts against binary outcomes (Mason 1982):
|
|
37
|
+
* the hit rate against the false alarm rate of every threshold rule, at each
|
|
38
|
+
* distinct forecast value, and the area under it. It measures discrimination
|
|
39
|
+
* alone, blind to calibration; pair it with a {@link reliabilityDiagram}.
|
|
40
|
+
*
|
|
41
|
+
* With `thresholds`, the curve has only the rules a user can act on (the
|
|
42
|
+
* probabilities `k/m` an `m`-member ensemble can issue, or a few warning
|
|
43
|
+
* levels): its area, closed to `(1, 1)` by a last point at threshold `−∞`, is
|
|
44
|
+
* then the trapezoidal area of those points, below the empirical one.
|
|
45
|
+
*
|
|
46
|
+
* O(n log n + t) time, O(n + t) memory.
|
|
47
|
+
*
|
|
48
|
+
* @param probabilities The forecast probabilities, in `[0, 1]`.
|
|
49
|
+
* @param outcomes The binary outcomes, `0` or `1`.
|
|
50
|
+
* @param options Case weights and decision thresholds.
|
|
51
|
+
* @returns The curve; its rates are `NaN` without events (hit rate) or
|
|
52
|
+
* non-events (false alarm rate).
|
|
53
|
+
* @throws {RangeError} When the lengths differ, a probability lies outside `[0,
|
|
54
|
+
* 1]`, an outcome is not `0` or `1`, the weights are invalid, or a threshold
|
|
55
|
+
* is `NaN` or repeated.
|
|
56
|
+
*/
|
|
57
|
+
export declare function rocCurve(probabilities: ArrayLike<number>, outcomes: ArrayLike<number>, options?: RocCurveOptions): RocCurve;
|
|
58
|
+
//# sourceMappingURL=roc-curve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roc-curve.d.ts","sourceRoot":"","sources":["../../src/forecast/roc-curve.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG;IACtD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CACvB,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,EAChC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAC3B,OAAO,CAAC,EAAE,eAAe,GACvB,QAAQ,CA4HV"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { describeValue } from "@ac-kit/core";
|
|
2
|
+
import { assertBinary_, assertProbabilities_, assertSameLength_, weightTotal_, } from "./_forecast-checks.js";
|
|
3
|
+
/**
|
|
4
|
+
* The ROC curve of probability forecasts against binary outcomes (Mason 1982):
|
|
5
|
+
* the hit rate against the false alarm rate of every threshold rule, at each
|
|
6
|
+
* distinct forecast value, and the area under it. It measures discrimination
|
|
7
|
+
* alone, blind to calibration; pair it with a {@link reliabilityDiagram}.
|
|
8
|
+
*
|
|
9
|
+
* With `thresholds`, the curve has only the rules a user can act on (the
|
|
10
|
+
* probabilities `k/m` an `m`-member ensemble can issue, or a few warning
|
|
11
|
+
* levels): its area, closed to `(1, 1)` by a last point at threshold `−∞`, is
|
|
12
|
+
* then the trapezoidal area of those points, below the empirical one.
|
|
13
|
+
*
|
|
14
|
+
* O(n log n + t) time, O(n + t) memory.
|
|
15
|
+
*
|
|
16
|
+
* @param probabilities The forecast probabilities, in `[0, 1]`.
|
|
17
|
+
* @param outcomes The binary outcomes, `0` or `1`.
|
|
18
|
+
* @param options Case weights and decision thresholds.
|
|
19
|
+
* @returns The curve; its rates are `NaN` without events (hit rate) or
|
|
20
|
+
* non-events (false alarm rate).
|
|
21
|
+
* @throws {RangeError} When the lengths differ, a probability lies outside `[0,
|
|
22
|
+
* 1]`, an outcome is not `0` or `1`, the weights are invalid, or a threshold
|
|
23
|
+
* is `NaN` or repeated.
|
|
24
|
+
*/
|
|
25
|
+
export function rocCurve(probabilities, outcomes, options) {
|
|
26
|
+
const count = probabilities.length;
|
|
27
|
+
assertSameLength_("rocCurve", "probabilities", count, "outcomes", outcomes.length);
|
|
28
|
+
assertProbabilities_("rocCurve", probabilities);
|
|
29
|
+
assertBinary_("rocCurve", outcomes);
|
|
30
|
+
const weights = options?.weights ?? null;
|
|
31
|
+
weightTotal_("rocCurve", weights, count);
|
|
32
|
+
const order = new Uint32Array(count);
|
|
33
|
+
for (let index = 0; index < count; index++) {
|
|
34
|
+
order[index] = index;
|
|
35
|
+
}
|
|
36
|
+
order.sort((left, right) => probabilities[right] - probabilities[left]);
|
|
37
|
+
let events = 0;
|
|
38
|
+
let nonEvents = 0;
|
|
39
|
+
let distinct = 0;
|
|
40
|
+
for (let position = 0; position < count; position++) {
|
|
41
|
+
const index = order[position];
|
|
42
|
+
const weight = weights === null ? 1 : weights[index];
|
|
43
|
+
if (outcomes[index] === 1) {
|
|
44
|
+
events += weight;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
nonEvents += weight;
|
|
48
|
+
}
|
|
49
|
+
if (position === 0 ||
|
|
50
|
+
probabilities[index] !== probabilities[order[position - 1]]) {
|
|
51
|
+
distinct++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const given = options?.thresholds ?? null;
|
|
55
|
+
let thresholds;
|
|
56
|
+
if (given === null) {
|
|
57
|
+
thresholds = new Float64Array(distinct + 1);
|
|
58
|
+
let point = 0;
|
|
59
|
+
for (let position = 0; position < count; position++) {
|
|
60
|
+
const index = order[position];
|
|
61
|
+
if (position === count - 1 ||
|
|
62
|
+
probabilities[order[position + 1]] !== probabilities[index]) {
|
|
63
|
+
thresholds[++point] = probabilities[index];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
thresholds = new Float64Array(given.length + 2);
|
|
69
|
+
thresholds.set(Float64Array.from(given).sort().reverse(), 1);
|
|
70
|
+
thresholds[given.length + 1] = Number.NEGATIVE_INFINITY;
|
|
71
|
+
for (let point = 1; point <= given.length; point++) {
|
|
72
|
+
const threshold = thresholds[point];
|
|
73
|
+
if (threshold !== threshold ||
|
|
74
|
+
(point > 1 && threshold === thresholds[point - 1])) {
|
|
75
|
+
throw new RangeError(`rocCurve: thresholds must be distinct and not NaN, got ${describeValue(threshold)}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
thresholds[0] = Number.POSITIVE_INFINITY;
|
|
80
|
+
const points = thresholds.length;
|
|
81
|
+
const hitRate = new Float64Array(points);
|
|
82
|
+
const falseAlarmRate = new Float64Array(points);
|
|
83
|
+
let hits = 0;
|
|
84
|
+
let falseAlarms = 0;
|
|
85
|
+
let position = 0;
|
|
86
|
+
let area = 0;
|
|
87
|
+
// Rule j warns on every forecast at or above thresholds[j].
|
|
88
|
+
for (let point = 1; point < points; point++) {
|
|
89
|
+
const threshold = thresholds[point];
|
|
90
|
+
while (position < count) {
|
|
91
|
+
const index = order[position];
|
|
92
|
+
if (!(probabilities[index] >= threshold)) {
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const weight = weights === null ? 1 : weights[index];
|
|
96
|
+
if (outcomes[index] === 1) {
|
|
97
|
+
hits += weight;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
falseAlarms += weight;
|
|
101
|
+
}
|
|
102
|
+
position++;
|
|
103
|
+
}
|
|
104
|
+
hitRate[point] = hits / events;
|
|
105
|
+
falseAlarmRate[point] = falseAlarms / nonEvents;
|
|
106
|
+
area +=
|
|
107
|
+
(falseAlarmRate[point] - falseAlarmRate[point - 1]) *
|
|
108
|
+
0.5 *
|
|
109
|
+
(hitRate[point] + hitRate[point - 1]);
|
|
110
|
+
}
|
|
111
|
+
if (!(events > 0)) {
|
|
112
|
+
hitRate.fill(Number.NaN);
|
|
113
|
+
}
|
|
114
|
+
if (!(nonEvents > 0)) {
|
|
115
|
+
falseAlarmRate.fill(Number.NaN);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
thresholds,
|
|
119
|
+
hitRate,
|
|
120
|
+
falseAlarmRate,
|
|
121
|
+
area: events > 0 && nonEvents > 0 ? area : Number.NaN,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=roc-curve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roc-curve.js","sourceRoot":"","sources":["../../src/forecast/roc-curve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACN,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACZ,MAAM,uBAAuB,CAAC;AAsC/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,QAAQ,CACvB,aAAgC,EAChC,QAA2B,EAC3B,OAAyB;IAEzB,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC;IAEnC,iBAAiB,CAChB,UAAU,EACV,eAAe,EACf,KAAK,EACL,UAAU,EACV,QAAQ,CAAC,MAAM,CACf,CAAC;IACF,oBAAoB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAChD,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC;IAEzC,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;IAErC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAE,GAAG,aAAa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M,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,OAAO;QACN,UAAU;QACV,OAAO;QACP,cAAc;QACd,IAAI,EAAE,MAAM,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG;KACrD,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hierarchical-cluster.d.ts","sourceRoot":"","sources":["../src/hierarchical-cluster.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG;IACxC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAClC,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,EAC7C,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,0BAA0B,GAClC,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"hierarchical-cluster.d.ts","sourceRoot":"","sources":["../src/hierarchical-cluster.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG;IACxC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAClC,CAAC,EAAE,MAAM,EACT,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,EAC7C,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,0BAA0B,GAClC,MAAM,EAAE,EAAE,CAiGZ"}
|
|
@@ -18,8 +18,9 @@ import { dotPrecise } from "@ac-kit/math-scalar";
|
|
|
18
18
|
* @returns Array of clusters; each cluster is an array of original indices.
|
|
19
19
|
*/
|
|
20
20
|
export function hierarchicalCluster(n, getDistance, threshold, options) {
|
|
21
|
-
if (n === 0)
|
|
21
|
+
if (n === 0) {
|
|
22
22
|
return [];
|
|
23
|
+
}
|
|
23
24
|
const linkage = options?.linkage ?? "average";
|
|
24
25
|
// Build a symmetric n×n distance matrix.
|
|
25
26
|
// clusterDist[i][j] holds the current inter-cluster distance (same value at [j][i]).
|
|
@@ -42,11 +43,13 @@ export function hierarchicalCluster(n, getDistance, threshold, options) {
|
|
|
42
43
|
let mergeA = -1;
|
|
43
44
|
let mergeB = -1;
|
|
44
45
|
for (let i = 0; i < n; i++) {
|
|
45
|
-
if (!active[i])
|
|
46
|
+
if (!active[i]) {
|
|
46
47
|
continue;
|
|
48
|
+
}
|
|
47
49
|
for (let j = i + 1; j < n; j++) {
|
|
48
|
-
if (!active[j])
|
|
50
|
+
if (!active[j]) {
|
|
49
51
|
continue;
|
|
52
|
+
}
|
|
50
53
|
const d = clusterDist[i][j];
|
|
51
54
|
if (d < minDist) {
|
|
52
55
|
minDist = d;
|
|
@@ -55,16 +58,18 @@ export function hierarchicalCluster(n, getDistance, threshold, options) {
|
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
if (mergeA === -1 || minDist >= threshold)
|
|
61
|
+
if (mergeA === -1 || minDist >= threshold) {
|
|
59
62
|
break;
|
|
63
|
+
}
|
|
60
64
|
const nA = sizes[mergeA];
|
|
61
65
|
const nB = sizes[mergeB];
|
|
62
66
|
const dAB = clusterDist[mergeA][mergeB];
|
|
63
67
|
// Update distances from the merged cluster (mergeA absorbs mergeB) to all remaining
|
|
64
68
|
// active clusters using the Lance–Williams recurrence for the chosen linkage.
|
|
65
69
|
for (let c = 0; c < n; c++) {
|
|
66
|
-
if (!active[c] || c === mergeA || c === mergeB)
|
|
70
|
+
if (!active[c] || c === mergeA || c === mergeB) {
|
|
67
71
|
continue;
|
|
72
|
+
}
|
|
68
73
|
const nC = sizes[c];
|
|
69
74
|
const dAC = clusterDist[mergeA][c];
|
|
70
75
|
const dBC = clusterDist[mergeB][c];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hierarchical-cluster.js","sourceRoot":"","sources":["../src/hierarchical-cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmBjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CAClC,CAAS,EACT,WAA6C,EAC7C,SAAiB,EACjB,OAAoC;IAEpC,IAAI,CAAC,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"hierarchical-cluster.js","sourceRoot":"","sources":["../src/hierarchical-cluster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmBjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CAClC,CAAS,EACT,WAA6C,EAC7C,SAAiB,EACjB,OAAoC;IAEpC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,SAAS,CAAC;IAE9C,yCAAyC;IACzC,qFAAqF;IACrF,MAAM,WAAW,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAC9D,KAAK,CAAC,IAAI,CAAS,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzC,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EA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C,MAAM,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { HistogramBinRule } from "./histogram.js";
|
|
2
|
+
/** Options of {@link histogramEdges}. */
|
|
3
|
+
export type HistogramEdgesOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* The rule of thumb that picks the bin width. Default `"auto"`, NumPy's.
|
|
6
|
+
* Excludes `width` and `count`.
|
|
7
|
+
*/
|
|
8
|
+
readonly rule?: HistogramBinRule | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The bin width itself, finite and positive. Excludes `rule`, `count` and
|
|
11
|
+
* `maxCount`.
|
|
12
|
+
*/
|
|
13
|
+
readonly width?: number | undefined;
|
|
14
|
+
/** The bin count itself, an integer ≥ 1. Excludes `rule` and `width`. */
|
|
15
|
+
readonly count?: number | undefined;
|
|
16
|
+
/** The most bins, an integer ≥ 1. Excludes `width`. */
|
|
17
|
+
readonly maxCount?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Round edges, as Vega's `bin` places them: a width of 1, 2 or 5 times a
|
|
20
|
+
* power of ten, edges on its multiples. Default `false`, NumPy's equal bins
|
|
21
|
+
* from the low end of the range to the high end.
|
|
22
|
+
*/
|
|
23
|
+
readonly nice?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The `[low, high]` the bins cover, finite with `low ≤ high`; values outside
|
|
26
|
+
* it are left out of the rule's sample. Default the extent of the finite
|
|
27
|
+
* values.
|
|
28
|
+
*/
|
|
29
|
+
readonly range?: readonly [low: number, high: number] | undefined;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The edges of a histogram's bins over the finite values of `values`: equal
|
|
33
|
+
* bins as NumPy's `histogram_bin_edges` cuts them, or, with `nice`, round edges
|
|
34
|
+
* as Vega's `bin` places them. The bins are half-open, `[edges[i], edges[i +
|
|
35
|
+
* 1])`, but for the last, which is closed; {@link histogram} counts into them
|
|
36
|
+
* with `lastClosed`.
|
|
37
|
+
*
|
|
38
|
+
* **The range** is `range`, or the extent of the finite values; `[0, 1]` when
|
|
39
|
+
* there are none. `NaN` and the infinities are ignored, there and in the rule's
|
|
40
|
+
* sample, where NumPy refuses a range that is not finite. An empty range (a
|
|
41
|
+
* single value) is widened to `[x − 0.5, x + 0.5]`, as NumPy does (to the
|
|
42
|
+
* neighbouring doubles where 0.5 is below their spacing); with `nice`, it takes
|
|
43
|
+
* the value's magnitude (or 1 for 0) as its span, as Vega does.
|
|
44
|
+
*
|
|
45
|
+
* **The width** is `width`; or the range over `count`; or the `rule`'s over the
|
|
46
|
+
* values within the range ({@link histogramBinWidth}, default `"auto"`). Where
|
|
47
|
+
* a rule finds no width though the values spread (Freedman–Diaconis' zero
|
|
48
|
+
* interquartile range, Doane's fewer than three values, Stone's), Sturges'
|
|
49
|
+
* stands in, where NumPy would make one bin; where none can (fewer than two
|
|
50
|
+
* values in the range, or all equal), there is one bin, or with `nice` as many
|
|
51
|
+
* as `maxCount` allows.
|
|
52
|
+
*
|
|
53
|
+
* **Equal bins** (the default) run from the low end to the high end, their
|
|
54
|
+
* count the range over the width rounded up and at most `maxCount`; edge `i` is
|
|
55
|
+
* `low + i · (high − low) / count`, the last `high` itself, as NumPy's
|
|
56
|
+
* `linspace`. A `width` instead gives edges `low + i · width`, the last at or
|
|
57
|
+
* past `high`.
|
|
58
|
+
*
|
|
59
|
+
* **Nice bins** have a width of 1, 2 or 5 times a power of ten, the smallest at
|
|
60
|
+
* least the rule's or `count`'s (within 10⁻¹²), widened along that sequence
|
|
61
|
+
* until there are at most `maxCount` bins; edges are its multiples, from the
|
|
62
|
+
* one at or below the range to the one at or above it, a step below 1 dividing
|
|
63
|
+
* an integer index so that 0.3 is 0.3. A `width` is kept as given, its edges on
|
|
64
|
+
* its multiples (exact quotients when it is within 10⁻⁹ of the reciprocal of an
|
|
65
|
+
* integer). A range across 0 makes two bins at least; a `maxCount` of 1 joins
|
|
66
|
+
* them into one, `[−s, s]`.
|
|
67
|
+
*
|
|
68
|
+
* Edges are strictly ascending and finite: a range holding fewer doubles than
|
|
69
|
+
* bins has the edges that round together merged. With `nice`, a single value
|
|
70
|
+
* where the multiples of the width are closer than the doubles (a `width` of
|
|
71
|
+
* 0.1 at 10¹⁶) gets one bin from the value to the next double up (from the one
|
|
72
|
+
* below at `Number.MAX_VALUE`), both roundings of multiples: always two edges
|
|
73
|
+
* around it, as without `nice`.
|
|
74
|
+
*
|
|
75
|
+
* Time O(n + k) for `n` values and `k` bins, plus the rule's
|
|
76
|
+
* ({@link histogramBinWidth}); memory O(k), plus the rule's.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* histogramEdges([1, 2, 2, 3, 7], { count: 3 }); // [1, 3, 5, 7]
|
|
80
|
+
* histogramEdges([0.13, 4.2, 9.7], { count: 4, nice: true }); // [0, 5, 10]
|
|
81
|
+
*
|
|
82
|
+
* @param values - The sample, in any order; a typed array is read as is. Not
|
|
83
|
+
* modified.
|
|
84
|
+
* @param options - How to choose the bins.
|
|
85
|
+
* @returns At least two edges, strictly ascending.
|
|
86
|
+
* @throws {RangeError} For a `width` that is not finite and positive, a `count`
|
|
87
|
+
* or `maxCount` that is not an integer ≥ 1, an unknown `rule`, a `range` that
|
|
88
|
+
* is not finite and ordered, options that exclude each other, more than 2³² −
|
|
89
|
+
* 2 bins, and edges that would leave the double range.
|
|
90
|
+
*/
|
|
91
|
+
export declare function histogramEdges(values: ArrayLike<number>, options?: HistogramEdgesOptions): Float64Array;
|
|
92
|
+
//# sourceMappingURL=histogram-edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"histogram-edges.d.ts","sourceRoot":"","sources":["../src/histogram-edges.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,yCAAyC;AACzC,MAAM,MAAM,qBAAqB,GAAG;IACnC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAClE,CAAC;AAoSF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,OAAO,GAAE,qBAA0B,GACjC,YAAY,CA6Bd"}
|