Merged with develop
This commit is contained in:
commit
ab88b0d012
|
@ -31,9 +31,9 @@
|
||||||
"@testing-library/user-event": "^14.2.0",
|
"@testing-library/user-event": "^14.2.0",
|
||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/lodash": "^4.14.182",
|
"@types/lodash": "^4.14.182",
|
||||||
"@types/node": "^17.0.32",
|
"@types/node": "^17.0.33",
|
||||||
"@types/react": "^18.0.9",
|
"@types/react": "^18.0.9",
|
||||||
"@types/react-dom": "^18.0.2",
|
"@types/react-dom": "^18.0.4",
|
||||||
"@types/styled-components": "^5.1.24",
|
"@types/styled-components": "^5.1.24",
|
||||||
"@types/webpack": "^5.28.0",
|
"@types/webpack": "^5.28.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
|
|
@ -31,6 +31,9 @@ describe("eval on distribution functions", () => {
|
||||||
testEval("mean(normal(5,2))", "Ok(5)")
|
testEval("mean(normal(5,2))", "Ok(5)")
|
||||||
testEval("mean(lognormal(1,2))", "Ok(20.085536923187668)")
|
testEval("mean(lognormal(1,2))", "Ok(20.085536923187668)")
|
||||||
testEval("mean(gamma(5,5))", "Ok(25)")
|
testEval("mean(gamma(5,5))", "Ok(25)")
|
||||||
|
testEval("mean(bernoulli(0.2))", "Ok(0.2)")
|
||||||
|
testEval("mean(bernoulli(0.8))", "Ok(0.8)")
|
||||||
|
testEval("mean(logistic(5,1))", "Ok(5)")
|
||||||
})
|
})
|
||||||
describe("toString", () => {
|
describe("toString", () => {
|
||||||
testEval("toString(normal(5,2))", "Ok('Normal(5,2)')")
|
testEval("toString(normal(5,2))", "Ok('Normal(5,2)')")
|
||||||
|
|
|
@ -34,27 +34,28 @@
|
||||||
],
|
],
|
||||||
"author": "Quantified Uncertainty Research Institute",
|
"author": "Quantified Uncertainty Research Institute",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rescript": "^9.1.4",
|
"@stdlib/stats": "^0.0.13",
|
||||||
"jstat": "^1.9.5",
|
"jstat": "^1.9.5",
|
||||||
|
"mathjs": "^10.5.2",
|
||||||
"pdfast": "^0.2.0",
|
"pdfast": "^0.2.0",
|
||||||
"mathjs": "^10.5.2"
|
"rescript": "^9.1.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bisect_ppx": "^2.7.1",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"rescript-fast-check": "^1.1.1",
|
|
||||||
"@glennsl/rescript-jest": "^0.9.0",
|
"@glennsl/rescript-jest": "^0.9.0",
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
||||||
|
"bisect_ppx": "^2.7.1",
|
||||||
"chalk": "^5.0.1",
|
"chalk": "^5.0.1",
|
||||||
"codecov": "^3.8.3",
|
"codecov": "^3.8.3",
|
||||||
"fast-check": "^2.25.0",
|
"fast-check": "^2.25.0",
|
||||||
"gentype": "^4.3.0",
|
"gentype": "^4.3.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"moduleserve": "^0.9.1",
|
"moduleserve": "^0.9.1",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"reanalyze": "^2.19.0",
|
"reanalyze": "^2.19.0",
|
||||||
|
"rescript-fast-check": "^1.1.1",
|
||||||
"ts-jest": "^27.1.4",
|
"ts-jest": "^27.1.4",
|
||||||
"ts-loader": "^9.3.0",
|
"ts-loader": "^9.3.0",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.7.0",
|
||||||
|
|
|
@ -146,7 +146,16 @@ let rec run = (~env, functionCallInfo: functionCallInfo): outputType => {
|
||||||
}
|
}
|
||||||
| ToDist(Normalize) => dist->GenericDist.normalize->Dist
|
| ToDist(Normalize) => dist->GenericDist.normalize->Dist
|
||||||
| ToScore(KLDivergence(t2)) =>
|
| ToScore(KLDivergence(t2)) =>
|
||||||
GenericDist.klDivergence(dist, t2, ~toPointSetFn)
|
GenericDist.Score.klDivergence(dist, t2, ~toPointSetFn)
|
||||||
|
->E.R2.fmap(r => Float(r))
|
||||||
|
->OutputLocal.fromResult
|
||||||
|
| ToScore(LogScore(answer, prior)) =>
|
||||||
|
GenericDist.Score.logScoreWithPointResolution(
|
||||||
|
~prediction=dist,
|
||||||
|
~answer,
|
||||||
|
~prior,
|
||||||
|
~toPointSetFn,
|
||||||
|
)
|
||||||
->E.R2.fmap(r => Float(r))
|
->E.R2.fmap(r => Float(r))
|
||||||
->OutputLocal.fromResult
|
->OutputLocal.fromResult
|
||||||
| ToBool(IsNormalized) => dist->GenericDist.isNormalized->Bool
|
| ToBool(IsNormalized) => dist->GenericDist.isNormalized->Bool
|
||||||
|
@ -263,6 +272,12 @@ module Constructors = {
|
||||||
let normalize = (~env, dist) => C.normalize(dist)->run(~env)->toDistR
|
let normalize = (~env, dist) => C.normalize(dist)->run(~env)->toDistR
|
||||||
let isNormalized = (~env, dist) => C.isNormalized(dist)->run(~env)->toBoolR
|
let isNormalized = (~env, dist) => C.isNormalized(dist)->run(~env)->toBoolR
|
||||||
let klDivergence = (~env, dist1, dist2) => C.klDivergence(dist1, dist2)->run(~env)->toFloatR
|
let klDivergence = (~env, dist1, dist2) => C.klDivergence(dist1, dist2)->run(~env)->toFloatR
|
||||||
|
let logScoreWithPointResolution = (
|
||||||
|
~env,
|
||||||
|
~prediction: DistributionTypes.genericDist,
|
||||||
|
~answer: float,
|
||||||
|
~prior: option<DistributionTypes.genericDist>,
|
||||||
|
) => C.logScoreWithPointResolution(~prediction, ~answer, ~prior)->run(~env)->toFloatR
|
||||||
let toPointSet = (~env, dist) => C.toPointSet(dist)->run(~env)->toDistR
|
let toPointSet = (~env, dist) => C.toPointSet(dist)->run(~env)->toDistR
|
||||||
let toSampleSet = (~env, dist, n) => C.toSampleSet(dist, n)->run(~env)->toDistR
|
let toSampleSet = (~env, dist, n) => C.toSampleSet(dist, n)->run(~env)->toDistR
|
||||||
let fromSamples = (~env, xs) => C.fromSamples(xs)->run(~env)->toDistR
|
let fromSamples = (~env, xs) => C.fromSamples(xs)->run(~env)->toDistR
|
||||||
|
|
|
@ -63,6 +63,13 @@ module Constructors: {
|
||||||
@genType
|
@genType
|
||||||
let klDivergence: (~env: env, genericDist, genericDist) => result<float, error>
|
let klDivergence: (~env: env, genericDist, genericDist) => result<float, error>
|
||||||
@genType
|
@genType
|
||||||
|
let logScoreWithPointResolution: (
|
||||||
|
~env: env,
|
||||||
|
~prediction: genericDist,
|
||||||
|
~answer: float,
|
||||||
|
~prior: option<genericDist>,
|
||||||
|
) => result<float, error>
|
||||||
|
@genType
|
||||||
let toPointSet: (~env: env, genericDist) => result<genericDist, error>
|
let toPointSet: (~env: env, genericDist) => result<genericDist, error>
|
||||||
@genType
|
@genType
|
||||||
let toSampleSet: (~env: env, genericDist, int) => result<genericDist, error>
|
let toSampleSet: (~env: env, genericDist, int) => result<genericDist, error>
|
||||||
|
|
|
@ -92,7 +92,7 @@ module DistributionOperation = {
|
||||||
| ToString
|
| ToString
|
||||||
| ToSparkline(int)
|
| ToSparkline(int)
|
||||||
|
|
||||||
type toScore = KLDivergence(genericDist)
|
type toScore = KLDivergence(genericDist) | LogScore(float, option<genericDist>)
|
||||||
|
|
||||||
type fromDist =
|
type fromDist =
|
||||||
| ToFloat(toFloat)
|
| ToFloat(toFloat)
|
||||||
|
@ -121,6 +121,7 @@ module DistributionOperation = {
|
||||||
| ToFloat(#Sample) => `sample`
|
| ToFloat(#Sample) => `sample`
|
||||||
| ToFloat(#IntegralSum) => `integralSum`
|
| ToFloat(#IntegralSum) => `integralSum`
|
||||||
| ToScore(KLDivergence(_)) => `klDivergence`
|
| ToScore(KLDivergence(_)) => `klDivergence`
|
||||||
|
| ToScore(LogScore(x, _)) => `logScore against ${E.Float.toFixed(x)}`
|
||||||
| ToDist(Normalize) => `normalize`
|
| ToDist(Normalize) => `normalize`
|
||||||
| ToDist(ToPointSet) => `toPointSet`
|
| ToDist(ToPointSet) => `toPointSet`
|
||||||
| ToDist(ToSampleSet(r)) => `toSampleSet(${E.I.toString(r)})`
|
| ToDist(ToSampleSet(r)) => `toSampleSet(${E.I.toString(r)})`
|
||||||
|
@ -162,6 +163,10 @@ module Constructors = {
|
||||||
let truncate = (dist, left, right): t => FromDist(ToDist(Truncate(left, right)), dist)
|
let truncate = (dist, left, right): t => FromDist(ToDist(Truncate(left, right)), dist)
|
||||||
let inspect = (dist): t => FromDist(ToDist(Inspect), dist)
|
let inspect = (dist): t => FromDist(ToDist(Inspect), dist)
|
||||||
let klDivergence = (dist1, dist2): t => FromDist(ToScore(KLDivergence(dist2)), dist1)
|
let klDivergence = (dist1, dist2): t => FromDist(ToScore(KLDivergence(dist2)), dist1)
|
||||||
|
let logScoreWithPointResolution = (~prediction, ~answer, ~prior): t => FromDist(
|
||||||
|
ToScore(LogScore(answer, prior)),
|
||||||
|
prediction,
|
||||||
|
)
|
||||||
let scalePower = (dist, n): t => FromDist(ToDist(Scale(#Power, n)), dist)
|
let scalePower = (dist, n): t => FromDist(ToDist(Scale(#Power, n)), dist)
|
||||||
let scaleLogarithm = (dist, n): t => FromDist(ToDist(Scale(#Logarithm, n)), dist)
|
let scaleLogarithm = (dist, n): t => FromDist(ToDist(Scale(#Logarithm, n)), dist)
|
||||||
let scaleLogarithmWithThreshold = (dist, n, eps): t => FromDist(
|
let scaleLogarithmWithThreshold = (dist, n, eps): t => FromDist(
|
||||||
|
|
|
@ -59,11 +59,44 @@ let integralEndY = (t: t): float =>
|
||||||
|
|
||||||
let isNormalized = (t: t): bool => Js.Math.abs_float(integralEndY(t) -. 1.0) < 1e-7
|
let isNormalized = (t: t): bool => Js.Math.abs_float(integralEndY(t) -. 1.0) < 1e-7
|
||||||
|
|
||||||
let klDivergence = (t1, t2, ~toPointSetFn: toPointSetFn): result<float, error> => {
|
module Score = {
|
||||||
let pointSets = E.R.merge(toPointSetFn(t1), toPointSetFn(t2))
|
let klDivergence = (prediction, answer, ~toPointSetFn: toPointSetFn): result<float, error> => {
|
||||||
pointSets |> E.R2.bind(((a, b)) =>
|
let pointSets = E.R.merge(toPointSetFn(prediction), toPointSetFn(answer))
|
||||||
PointSetDist.T.klDivergence(a, b)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
pointSets |> E.R2.bind(((predi, ans)) =>
|
||||||
|
PointSetDist.T.klDivergence(predi, ans)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
let logScoreWithPointResolution = (
|
||||||
|
~prediction: DistributionTypes.genericDist,
|
||||||
|
~answer: float,
|
||||||
|
~prior: option<DistributionTypes.genericDist>,
|
||||||
|
~toPointSetFn: toPointSetFn,
|
||||||
|
): result<float, error> => {
|
||||||
|
switch prior {
|
||||||
|
| Some(prior') =>
|
||||||
|
E.R.merge(toPointSetFn(prior'), toPointSetFn(prediction))->E.R.bind(((
|
||||||
|
prior'',
|
||||||
|
prediction'',
|
||||||
|
)) =>
|
||||||
|
PointSetDist.T.logScoreWithPointResolution(
|
||||||
|
~prediction=prediction'',
|
||||||
|
~answer,
|
||||||
|
~prior=prior''->Some,
|
||||||
|
)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
||||||
|
)
|
||||||
|
| None =>
|
||||||
|
prediction
|
||||||
|
->toPointSetFn
|
||||||
|
->E.R.bind(x =>
|
||||||
|
PointSetDist.T.logScoreWithPointResolution(
|
||||||
|
~prediction=x,
|
||||||
|
~answer,
|
||||||
|
~prior=None,
|
||||||
|
)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let toFloatOperation = (
|
let toFloatOperation = (
|
||||||
|
|
|
@ -23,7 +23,15 @@ let toFloatOperation: (
|
||||||
~distToFloatOperation: DistributionTypes.DistributionOperation.toFloat,
|
~distToFloatOperation: DistributionTypes.DistributionOperation.toFloat,
|
||||||
) => result<float, error>
|
) => result<float, error>
|
||||||
|
|
||||||
let klDivergence: (t, t, ~toPointSetFn: toPointSetFn) => result<float, error>
|
module Score: {
|
||||||
|
let klDivergence: (t, t, ~toPointSetFn: toPointSetFn) => result<float, error>
|
||||||
|
let logScoreWithPointResolution: (
|
||||||
|
~prediction: t,
|
||||||
|
~answer: float,
|
||||||
|
~prior: option<t>,
|
||||||
|
~toPointSetFn: toPointSetFn,
|
||||||
|
) => result<float, error>
|
||||||
|
}
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let toPointSet: (
|
let toPointSet: (
|
||||||
|
|
|
@ -277,13 +277,12 @@ module T = Dist({
|
||||||
prediction.xyShape,
|
prediction.xyShape,
|
||||||
answer.xyShape,
|
answer.xyShape,
|
||||||
)
|
)
|
||||||
let xyShapeToContinuous: XYShape.xyShape => t = xyShape => {
|
newShape->E.R2.fmap(x => x->make->integralEndY)
|
||||||
xyShape: xyShape,
|
|
||||||
interpolation: #Linear,
|
|
||||||
integralSumCache: None,
|
|
||||||
integralCache: None,
|
|
||||||
}
|
}
|
||||||
newShape->E.R2.fmap(x => x->xyShapeToContinuous->integralEndY)
|
let logScoreWithPointResolution = (~prediction: t, ~answer: float, ~prior: option<t>) => {
|
||||||
|
let priorPdf = prior->E.O2.fmap((shape, x) => XYShape.XtoY.linear(x, shape.xyShape))
|
||||||
|
let predictionPdf = x => XYShape.XtoY.linear(x, prediction.xyShape)
|
||||||
|
PointSetDist_Scoring.LogScoreWithPointResolution.score(~priorPdf, ~predictionPdf, ~answer)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -229,4 +229,7 @@ module T = Dist({
|
||||||
answer,
|
answer,
|
||||||
)->E.R2.fmap(integralEndY)
|
)->E.R2.fmap(integralEndY)
|
||||||
}
|
}
|
||||||
|
let logScoreWithPointResolution = (~prediction: t, ~answer: float, ~prior: option<t>) => {
|
||||||
|
Error(Operation.NotYetImplemented)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -34,6 +34,11 @@ module type dist = {
|
||||||
let mean: t => float
|
let mean: t => float
|
||||||
let variance: t => float
|
let variance: t => float
|
||||||
let klDivergence: (t, t) => result<float, Operation.Error.t>
|
let klDivergence: (t, t) => result<float, Operation.Error.t>
|
||||||
|
let logScoreWithPointResolution: (
|
||||||
|
~prediction: t,
|
||||||
|
~answer: float,
|
||||||
|
~prior: option<t>,
|
||||||
|
) => result<float, Operation.Error.t>
|
||||||
}
|
}
|
||||||
|
|
||||||
module Dist = (T: dist) => {
|
module Dist = (T: dist) => {
|
||||||
|
@ -57,6 +62,7 @@ module Dist = (T: dist) => {
|
||||||
let variance = T.variance
|
let variance = T.variance
|
||||||
let integralEndY = T.integralEndY
|
let integralEndY = T.integralEndY
|
||||||
let klDivergence = T.klDivergence
|
let klDivergence = T.klDivergence
|
||||||
|
let logScoreWithPointResolution = T.logScoreWithPointResolution
|
||||||
|
|
||||||
let updateIntegralCache = T.updateIntegralCache
|
let updateIntegralCache = T.updateIntegralCache
|
||||||
|
|
||||||
|
|
|
@ -306,6 +306,9 @@ module T = Dist({
|
||||||
let klContinuousPart = Continuous.T.klDivergence(prediction.continuous, answer.continuous)
|
let klContinuousPart = Continuous.T.klDivergence(prediction.continuous, answer.continuous)
|
||||||
E.R.merge(klDiscretePart, klContinuousPart)->E.R2.fmap(t => fst(t) +. snd(t))
|
E.R.merge(klDiscretePart, klContinuousPart)->E.R2.fmap(t => fst(t) +. snd(t))
|
||||||
}
|
}
|
||||||
|
let logScoreWithPointResolution = (~prediction: t, ~answer: float, ~prior: option<t>) => {
|
||||||
|
Error(Operation.NotYetImplemented)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let combineAlgebraically = (op: Operation.convolutionOperation, t1: t, t2: t): t => {
|
let combineAlgebraically = (op: Operation.convolutionOperation, t1: t, t2: t): t => {
|
||||||
|
|
|
@ -196,12 +196,21 @@ module T = Dist({
|
||||||
| Continuous(m) => Continuous.T.variance(m)
|
| Continuous(m) => Continuous.T.variance(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
let klDivergence = (t1: t, t2: t) =>
|
let klDivergence = (prediction: t, answer: t) =>
|
||||||
switch (t1, t2) {
|
switch (prediction, answer) {
|
||||||
| (Continuous(t1), Continuous(t2)) => Continuous.T.klDivergence(t1, t2)
|
| (Continuous(t1), Continuous(t2)) => Continuous.T.klDivergence(t1, t2)
|
||||||
| (Discrete(t1), Discrete(t2)) => Discrete.T.klDivergence(t1, t2)
|
| (Discrete(t1), Discrete(t2)) => Discrete.T.klDivergence(t1, t2)
|
||||||
| (Mixed(t1), Mixed(t2)) => Mixed.T.klDivergence(t1, t2)
|
| (m1, m2) => Mixed.T.klDivergence(m1->toMixed, m2->toMixed)
|
||||||
| _ => Error(NotYetImplemented)
|
}
|
||||||
|
|
||||||
|
let logScoreWithPointResolution = (~prediction: t, ~answer: float, ~prior: option<t>) => {
|
||||||
|
switch (prior, prediction) {
|
||||||
|
| (Some(Continuous(t1)), Continuous(t2)) =>
|
||||||
|
Continuous.T.logScoreWithPointResolution(~prediction=t2, ~answer, ~prior=t1->Some)
|
||||||
|
| (None, Continuous(t2)) =>
|
||||||
|
Continuous.T.logScoreWithPointResolution(~prediction=t2, ~answer, ~prior=None)
|
||||||
|
| _ => Error(Operation.NotYetImplemented)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -14,3 +14,33 @@ module KLDivergence = {
|
||||||
quot < 0.0 ? Error(Operation.ComplexNumberError) : Ok(-.answerElement *. logFn(quot))
|
quot < 0.0 ? Error(Operation.ComplexNumberError) : Ok(-.answerElement *. logFn(quot))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module LogScoreWithPointResolution = {
|
||||||
|
let logFn = Js.Math.log
|
||||||
|
let score = (
|
||||||
|
~priorPdf: option<float => float>,
|
||||||
|
~predictionPdf: float => float,
|
||||||
|
~answer: float,
|
||||||
|
): result<float, Operation.Error.t> => {
|
||||||
|
let numerator = answer->predictionPdf
|
||||||
|
if numerator < 0.0 {
|
||||||
|
Operation.PdfInvalidError->Error
|
||||||
|
} else if numerator == 0.0 {
|
||||||
|
infinity->Ok
|
||||||
|
} else {
|
||||||
|
-.(
|
||||||
|
switch priorPdf {
|
||||||
|
| None => numerator->logFn
|
||||||
|
| Some(f) => {
|
||||||
|
let priorDensityOfAnswer = f(answer)
|
||||||
|
if priorDensityOfAnswer == 0.0 {
|
||||||
|
neg_infinity
|
||||||
|
} else {
|
||||||
|
(numerator /. priorDensityOfAnswer)->logFn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)->Ok
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -216,6 +216,50 @@ module Uniform = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module Logistic = {
|
||||||
|
type t = logistic
|
||||||
|
let make = (location, scale) =>
|
||||||
|
scale > 0.0
|
||||||
|
? Ok(#Logistic({location: location, scale: scale}))
|
||||||
|
: Error("Scale must be positive")
|
||||||
|
|
||||||
|
let pdf = (x, t: t) => Stdlib.Logistic.pdf(x, t.location, t.scale)
|
||||||
|
let cdf = (x, t: t) => Stdlib.Logistic.cdf(x, t.location, t.scale)
|
||||||
|
let inv = (p, t: t) => Stdlib.Logistic.quantile(p, t.location, t.scale)
|
||||||
|
let sample = (t: t) => {
|
||||||
|
let s = Uniform.sample({low: 0.0, high: 1.0})
|
||||||
|
inv(s, t)
|
||||||
|
}
|
||||||
|
let mean = (t: t) => Ok(Stdlib.Logistic.mean(t.location, t.scale))
|
||||||
|
let toString = ({location, scale}: t) => j`Logistic($location,$scale)`
|
||||||
|
}
|
||||||
|
|
||||||
|
module Bernoulli = {
|
||||||
|
type t = bernoulli
|
||||||
|
let make = p =>
|
||||||
|
p >= 0.0 && p <= 1.0
|
||||||
|
? Ok(#Bernoulli({p: p}))
|
||||||
|
: Error("Bernoulli parameter must be between 0 and 1")
|
||||||
|
let pmf = (x, t: t) => Stdlib.Bernoulli.pmf(x, t.p)
|
||||||
|
|
||||||
|
//Bernoulli is a discrete distribution, so it doesn't really have a pdf().
|
||||||
|
//We fake this for now with the pmf function, but this should be fixed at some point.
|
||||||
|
let pdf = (x, t: t) => Stdlib.Bernoulli.pmf(x, t.p)
|
||||||
|
let cdf = (x, t: t) => Stdlib.Bernoulli.cdf(x, t.p)
|
||||||
|
let inv = (p, t: t) => Stdlib.Bernoulli.quantile(p, t.p)
|
||||||
|
let mean = (t: t) => Ok(Stdlib.Bernoulli.mean(t.p))
|
||||||
|
let min = (t: t) => t.p == 1.0 ? 1.0 : 0.0
|
||||||
|
let max = (t: t) => t.p == 0.0 ? 0.0 : 1.0
|
||||||
|
let sample = (t: t) => {
|
||||||
|
let s = Uniform.sample({low: 0.0, high: 1.0})
|
||||||
|
inv(s, t)
|
||||||
|
}
|
||||||
|
let toString = ({p}: t) => j`Bernoulli($p)`
|
||||||
|
let toPointSetDist = ({p}: t): PointSetTypes.pointSetDist => Discrete(
|
||||||
|
Discrete.make(~integralSumCache=Some(1.0), {xs: [0.0, 1.0], ys: [1.0 -. p, p]}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
module Gamma = {
|
module Gamma = {
|
||||||
type t = gamma
|
type t = gamma
|
||||||
let make = (shape: float, scale: float) => {
|
let make = (shape: float, scale: float) => {
|
||||||
|
@ -252,6 +296,9 @@ module Float = {
|
||||||
let mean = (t: t) => Ok(t)
|
let mean = (t: t) => Ok(t)
|
||||||
let sample = (t: t) => t
|
let sample = (t: t) => t
|
||||||
let toString = (t: t) => j`Delta($t)`
|
let toString = (t: t) => j`Delta($t)`
|
||||||
|
let toPointSetDist = (t: t): PointSetTypes.pointSetDist => Discrete(
|
||||||
|
Discrete.make(~integralSumCache=Some(1.0), {xs: [t], ys: [1.0]}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
module From90thPercentile = {
|
module From90thPercentile = {
|
||||||
|
@ -275,9 +322,11 @@ module T = {
|
||||||
| #Cauchy(n) => Cauchy.pdf(x, n)
|
| #Cauchy(n) => Cauchy.pdf(x, n)
|
||||||
| #Gamma(n) => Gamma.pdf(x, n)
|
| #Gamma(n) => Gamma.pdf(x, n)
|
||||||
| #Lognormal(n) => Lognormal.pdf(x, n)
|
| #Lognormal(n) => Lognormal.pdf(x, n)
|
||||||
|
| #Logistic(n) => Logistic.pdf(x, n)
|
||||||
| #Uniform(n) => Uniform.pdf(x, n)
|
| #Uniform(n) => Uniform.pdf(x, n)
|
||||||
| #Beta(n) => Beta.pdf(x, n)
|
| #Beta(n) => Beta.pdf(x, n)
|
||||||
| #Float(n) => Float.pdf(x, n)
|
| #Float(n) => Float.pdf(x, n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.pdf(x, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
let cdf = (x, dist) =>
|
let cdf = (x, dist) =>
|
||||||
|
@ -287,10 +336,12 @@ module T = {
|
||||||
| #Exponential(n) => Exponential.cdf(x, n)
|
| #Exponential(n) => Exponential.cdf(x, n)
|
||||||
| #Cauchy(n) => Cauchy.cdf(x, n)
|
| #Cauchy(n) => Cauchy.cdf(x, n)
|
||||||
| #Gamma(n) => Gamma.cdf(x, n)
|
| #Gamma(n) => Gamma.cdf(x, n)
|
||||||
|
| #Logistic(n) => Logistic.cdf(x, n)
|
||||||
| #Lognormal(n) => Lognormal.cdf(x, n)
|
| #Lognormal(n) => Lognormal.cdf(x, n)
|
||||||
| #Uniform(n) => Uniform.cdf(x, n)
|
| #Uniform(n) => Uniform.cdf(x, n)
|
||||||
| #Beta(n) => Beta.cdf(x, n)
|
| #Beta(n) => Beta.cdf(x, n)
|
||||||
| #Float(n) => Float.cdf(x, n)
|
| #Float(n) => Float.cdf(x, n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.cdf(x, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
let inv = (x, dist) =>
|
let inv = (x, dist) =>
|
||||||
|
@ -300,10 +351,12 @@ module T = {
|
||||||
| #Exponential(n) => Exponential.inv(x, n)
|
| #Exponential(n) => Exponential.inv(x, n)
|
||||||
| #Cauchy(n) => Cauchy.inv(x, n)
|
| #Cauchy(n) => Cauchy.inv(x, n)
|
||||||
| #Gamma(n) => Gamma.inv(x, n)
|
| #Gamma(n) => Gamma.inv(x, n)
|
||||||
|
| #Logistic(n) => Logistic.inv(x, n)
|
||||||
| #Lognormal(n) => Lognormal.inv(x, n)
|
| #Lognormal(n) => Lognormal.inv(x, n)
|
||||||
| #Uniform(n) => Uniform.inv(x, n)
|
| #Uniform(n) => Uniform.inv(x, n)
|
||||||
| #Beta(n) => Beta.inv(x, n)
|
| #Beta(n) => Beta.inv(x, n)
|
||||||
| #Float(n) => Float.inv(x, n)
|
| #Float(n) => Float.inv(x, n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.inv(x, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
let sample: symbolicDist => float = x =>
|
let sample: symbolicDist => float = x =>
|
||||||
|
@ -313,10 +366,12 @@ module T = {
|
||||||
| #Exponential(n) => Exponential.sample(n)
|
| #Exponential(n) => Exponential.sample(n)
|
||||||
| #Cauchy(n) => Cauchy.sample(n)
|
| #Cauchy(n) => Cauchy.sample(n)
|
||||||
| #Gamma(n) => Gamma.sample(n)
|
| #Gamma(n) => Gamma.sample(n)
|
||||||
|
| #Logistic(n) => Logistic.sample(n)
|
||||||
| #Lognormal(n) => Lognormal.sample(n)
|
| #Lognormal(n) => Lognormal.sample(n)
|
||||||
| #Uniform(n) => Uniform.sample(n)
|
| #Uniform(n) => Uniform.sample(n)
|
||||||
| #Beta(n) => Beta.sample(n)
|
| #Beta(n) => Beta.sample(n)
|
||||||
| #Float(n) => Float.sample(n)
|
| #Float(n) => Float.sample(n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.sample(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
let doN = (n, fn) => {
|
let doN = (n, fn) => {
|
||||||
|
@ -336,10 +391,12 @@ module T = {
|
||||||
| #Cauchy(n) => Cauchy.toString(n)
|
| #Cauchy(n) => Cauchy.toString(n)
|
||||||
| #Normal(n) => Normal.toString(n)
|
| #Normal(n) => Normal.toString(n)
|
||||||
| #Gamma(n) => Gamma.toString(n)
|
| #Gamma(n) => Gamma.toString(n)
|
||||||
|
| #Logistic(n) => Logistic.toString(n)
|
||||||
| #Lognormal(n) => Lognormal.toString(n)
|
| #Lognormal(n) => Lognormal.toString(n)
|
||||||
| #Uniform(n) => Uniform.toString(n)
|
| #Uniform(n) => Uniform.toString(n)
|
||||||
| #Beta(n) => Beta.toString(n)
|
| #Beta(n) => Beta.toString(n)
|
||||||
| #Float(n) => Float.toString(n)
|
| #Float(n) => Float.toString(n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.toString(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
let min: symbolicDist => float = x =>
|
let min: symbolicDist => float = x =>
|
||||||
|
@ -349,8 +406,10 @@ module T = {
|
||||||
| #Cauchy(n) => Cauchy.inv(minCdfValue, n)
|
| #Cauchy(n) => Cauchy.inv(minCdfValue, n)
|
||||||
| #Normal(n) => Normal.inv(minCdfValue, n)
|
| #Normal(n) => Normal.inv(minCdfValue, n)
|
||||||
| #Lognormal(n) => Lognormal.inv(minCdfValue, n)
|
| #Lognormal(n) => Lognormal.inv(minCdfValue, n)
|
||||||
|
| #Logistic(n) => Logistic.inv(minCdfValue, n)
|
||||||
| #Gamma(n) => Gamma.inv(minCdfValue, n)
|
| #Gamma(n) => Gamma.inv(minCdfValue, n)
|
||||||
| #Uniform({low}) => low
|
| #Uniform({low}) => low
|
||||||
|
| #Bernoulli(n) => Bernoulli.min(n)
|
||||||
| #Beta(n) => Beta.inv(minCdfValue, n)
|
| #Beta(n) => Beta.inv(minCdfValue, n)
|
||||||
| #Float(n) => n
|
| #Float(n) => n
|
||||||
}
|
}
|
||||||
|
@ -363,7 +422,9 @@ module T = {
|
||||||
| #Normal(n) => Normal.inv(maxCdfValue, n)
|
| #Normal(n) => Normal.inv(maxCdfValue, n)
|
||||||
| #Gamma(n) => Gamma.inv(maxCdfValue, n)
|
| #Gamma(n) => Gamma.inv(maxCdfValue, n)
|
||||||
| #Lognormal(n) => Lognormal.inv(maxCdfValue, n)
|
| #Lognormal(n) => Lognormal.inv(maxCdfValue, n)
|
||||||
|
| #Logistic(n) => Logistic.inv(maxCdfValue, n)
|
||||||
| #Beta(n) => Beta.inv(maxCdfValue, n)
|
| #Beta(n) => Beta.inv(maxCdfValue, n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.max(n)
|
||||||
| #Uniform({high}) => high
|
| #Uniform({high}) => high
|
||||||
| #Float(n) => n
|
| #Float(n) => n
|
||||||
}
|
}
|
||||||
|
@ -376,8 +437,10 @@ module T = {
|
||||||
| #Normal(n) => Normal.mean(n)
|
| #Normal(n) => Normal.mean(n)
|
||||||
| #Lognormal(n) => Lognormal.mean(n)
|
| #Lognormal(n) => Lognormal.mean(n)
|
||||||
| #Beta(n) => Beta.mean(n)
|
| #Beta(n) => Beta.mean(n)
|
||||||
|
| #Logistic(n) => Logistic.mean(n)
|
||||||
| #Uniform(n) => Uniform.mean(n)
|
| #Uniform(n) => Uniform.mean(n)
|
||||||
| #Gamma(n) => Gamma.mean(n)
|
| #Gamma(n) => Gamma.mean(n)
|
||||||
|
| #Bernoulli(n) => Bernoulli.mean(n)
|
||||||
| #Float(n) => Float.mean(n)
|
| #Float(n) => Float.mean(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +516,8 @@ module T = {
|
||||||
d: symbolicDist,
|
d: symbolicDist,
|
||||||
): PointSetTypes.pointSetDist =>
|
): PointSetTypes.pointSetDist =>
|
||||||
switch d {
|
switch d {
|
||||||
| #Float(v) => Discrete(Discrete.make(~integralSumCache=Some(1.0), {xs: [v], ys: [1.0]}))
|
| #Float(v) => Float.toPointSetDist(v)
|
||||||
|
| #Bernoulli(v) => Bernoulli.toPointSetDist(v)
|
||||||
| _ =>
|
| _ =>
|
||||||
let xs = interpolateXs(~xSelection, d, sampleCount)
|
let xs = interpolateXs(~xSelection, d, sampleCount)
|
||||||
let ys = xs |> E.A.fmap(x => pdf(x, d))
|
let ys = xs |> E.A.fmap(x => pdf(x, d))
|
||||||
|
|
|
@ -36,6 +36,13 @@ type gamma = {
|
||||||
scale: float,
|
scale: float,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type logistic = {
|
||||||
|
location: float,
|
||||||
|
scale: float,
|
||||||
|
}
|
||||||
|
|
||||||
|
type bernoulli = {p: float}
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type symbolicDist = [
|
type symbolicDist = [
|
||||||
| #Normal(normal)
|
| #Normal(normal)
|
||||||
|
@ -47,6 +54,8 @@ type symbolicDist = [
|
||||||
| #Triangular(triangular)
|
| #Triangular(triangular)
|
||||||
| #Gamma(gamma)
|
| #Gamma(gamma)
|
||||||
| #Float(float)
|
| #Float(float)
|
||||||
|
| #Bernoulli(bernoulli)
|
||||||
|
| #Logistic(logistic)
|
||||||
]
|
]
|
||||||
|
|
||||||
type analyticalSimplificationResult = [
|
type analyticalSimplificationResult = [
|
||||||
|
|
|
@ -12,6 +12,7 @@ module Epsilon = {
|
||||||
module Environment = {
|
module Environment = {
|
||||||
let defaultXYPointLength = 1000
|
let defaultXYPointLength = 1000
|
||||||
let defaultSampleCount = 10000
|
let defaultSampleCount = 10000
|
||||||
|
let sparklineLength = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
module OpCost = {
|
module OpCost = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module ExpressionValue = ReducerInterface_ExpressionValue
|
module ExpressionValue = ReducerInterface_ExpressionValue
|
||||||
type expressionValue = ReducerInterface_ExpressionValue.expressionValue
|
type expressionValue = ExpressionValue.expressionValue
|
||||||
|
|
||||||
module Helpers = {
|
module Helpers = {
|
||||||
let arithmeticMap = r =>
|
let arithmeticMap = r =>
|
||||||
|
@ -162,12 +162,27 @@ module Helpers = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let klDivergenceWithPrior = (
|
||||||
|
prediction: DistributionTypes.genericDist,
|
||||||
|
answer: DistributionTypes.genericDist,
|
||||||
|
prior: DistributionTypes.genericDist,
|
||||||
|
env: DistributionOperation.env,
|
||||||
|
) => {
|
||||||
|
let term1 = DistributionOperation.Constructors.klDivergence(~env, prediction, answer)
|
||||||
|
let term2 = DistributionOperation.Constructors.klDivergence(~env, prior, answer)
|
||||||
|
switch E.R.merge(term1, term2)->E.R2.fmap(((a, b)) => a -. b) {
|
||||||
|
| Ok(x) => x->DistributionOperation.Float->Some
|
||||||
|
| Error(_) => None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module SymbolicConstructors = {
|
module SymbolicConstructors = {
|
||||||
let oneFloat = name =>
|
let oneFloat = name =>
|
||||||
switch name {
|
switch name {
|
||||||
| "exponential" => Ok(SymbolicDist.Exponential.make)
|
| "exponential" => Ok(SymbolicDist.Exponential.make)
|
||||||
|
| "bernoulli" => Ok(SymbolicDist.Bernoulli.make)
|
||||||
| _ => Error("Unreachable state")
|
| _ => Error("Unreachable state")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +192,7 @@ module SymbolicConstructors = {
|
||||||
| "uniform" => Ok(SymbolicDist.Uniform.make)
|
| "uniform" => Ok(SymbolicDist.Uniform.make)
|
||||||
| "beta" => Ok(SymbolicDist.Beta.make)
|
| "beta" => Ok(SymbolicDist.Beta.make)
|
||||||
| "lognormal" => Ok(SymbolicDist.Lognormal.make)
|
| "lognormal" => Ok(SymbolicDist.Lognormal.make)
|
||||||
|
| "logistic" => Ok(SymbolicDist.Logistic.make)
|
||||||
| "cauchy" => Ok(SymbolicDist.Cauchy.make)
|
| "cauchy" => Ok(SymbolicDist.Cauchy.make)
|
||||||
| "gamma" => Ok(SymbolicDist.Gamma.make)
|
| "gamma" => Ok(SymbolicDist.Gamma.make)
|
||||||
| "to" => Ok(SymbolicDist.From90thPercentile.make)
|
| "to" => Ok(SymbolicDist.From90thPercentile.make)
|
||||||
|
@ -204,14 +220,21 @@ let dispatchToGenericOutput = (
|
||||||
): option<DistributionOperation.outputType> => {
|
): option<DistributionOperation.outputType> => {
|
||||||
let (fnName, args) = call
|
let (fnName, args) = call
|
||||||
switch (fnName, args) {
|
switch (fnName, args) {
|
||||||
| ("exponential" as fnName, [EvNumber(f)]) =>
|
| (("exponential" | "bernoulli") as fnName, [EvNumber(f)]) =>
|
||||||
SymbolicConstructors.oneFloat(fnName)
|
SymbolicConstructors.oneFloat(fnName)
|
||||||
->E.R.bind(r => r(f))
|
->E.R.bind(r => r(f))
|
||||||
->SymbolicConstructors.symbolicResultToOutput
|
->SymbolicConstructors.symbolicResultToOutput
|
||||||
| ("delta", [EvNumber(f)]) =>
|
| ("delta", [EvNumber(f)]) =>
|
||||||
SymbolicDist.Float.makeSafe(f)->SymbolicConstructors.symbolicResultToOutput
|
SymbolicDist.Float.makeSafe(f)->SymbolicConstructors.symbolicResultToOutput
|
||||||
| (
|
| (
|
||||||
("normal" | "uniform" | "beta" | "lognormal" | "cauchy" | "gamma" | "to") as fnName,
|
("normal"
|
||||||
|
| "uniform"
|
||||||
|
| "beta"
|
||||||
|
| "lognormal"
|
||||||
|
| "cauchy"
|
||||||
|
| "gamma"
|
||||||
|
| "to"
|
||||||
|
| "logistic") as fnName,
|
||||||
[EvNumber(f1), EvNumber(f2)],
|
[EvNumber(f1), EvNumber(f2)],
|
||||||
) =>
|
) =>
|
||||||
SymbolicConstructors.twoFloat(fnName)
|
SymbolicConstructors.twoFloat(fnName)
|
||||||
|
@ -227,7 +250,8 @@ let dispatchToGenericOutput = (
|
||||||
| ("mean", [EvDistribution(dist)]) => Helpers.toFloatFn(#Mean, dist, ~env)
|
| ("mean", [EvDistribution(dist)]) => Helpers.toFloatFn(#Mean, dist, ~env)
|
||||||
| ("integralSum", [EvDistribution(dist)]) => Helpers.toFloatFn(#IntegralSum, dist, ~env)
|
| ("integralSum", [EvDistribution(dist)]) => Helpers.toFloatFn(#IntegralSum, dist, ~env)
|
||||||
| ("toString", [EvDistribution(dist)]) => Helpers.toStringFn(ToString, dist, ~env)
|
| ("toString", [EvDistribution(dist)]) => Helpers.toStringFn(ToString, dist, ~env)
|
||||||
| ("toSparkline", [EvDistribution(dist)]) => Helpers.toStringFn(ToSparkline(20), dist, ~env)
|
| ("toSparkline", [EvDistribution(dist)]) =>
|
||||||
|
Helpers.toStringFn(ToSparkline(MagicNumbers.Environment.sparklineLength), dist, ~env)
|
||||||
| ("toSparkline", [EvDistribution(dist), EvNumber(n)]) =>
|
| ("toSparkline", [EvDistribution(dist), EvNumber(n)]) =>
|
||||||
Helpers.toStringFn(ToSparkline(Belt.Float.toInt(n)), dist, ~env)
|
Helpers.toStringFn(ToSparkline(Belt.Float.toInt(n)), dist, ~env)
|
||||||
| ("exp", [EvDistribution(a)]) =>
|
| ("exp", [EvDistribution(a)]) =>
|
||||||
|
@ -240,8 +264,28 @@ let dispatchToGenericOutput = (
|
||||||
~env,
|
~env,
|
||||||
)->Some
|
)->Some
|
||||||
| ("normalize", [EvDistribution(dist)]) => Helpers.toDistFn(Normalize, dist, ~env)
|
| ("normalize", [EvDistribution(dist)]) => Helpers.toDistFn(Normalize, dist, ~env)
|
||||||
| ("klDivergence", [EvDistribution(a), EvDistribution(b)]) =>
|
| ("klDivergence", [EvDistribution(prediction), EvDistribution(answer)]) =>
|
||||||
Some(DistributionOperation.run(FromDist(ToScore(KLDivergence(b)), a), ~env))
|
Some(DistributionOperation.run(FromDist(ToScore(KLDivergence(answer)), prediction), ~env))
|
||||||
|
| ("klDivergence", [EvDistribution(prediction), EvDistribution(answer), EvDistribution(prior)]) =>
|
||||||
|
Helpers.klDivergenceWithPrior(prediction, answer, prior, env)
|
||||||
|
| (
|
||||||
|
"logScoreWithPointAnswer",
|
||||||
|
[EvDistribution(prediction), EvNumber(answer), EvDistribution(prior)],
|
||||||
|
)
|
||||||
|
| (
|
||||||
|
"logScoreWithPointAnswer",
|
||||||
|
[EvDistribution(prediction), EvDistribution(Symbolic(#Float(answer))), EvDistribution(prior)],
|
||||||
|
) =>
|
||||||
|
DistributionOperation.run(
|
||||||
|
FromDist(ToScore(LogScore(answer, prior->Some)), prediction),
|
||||||
|
~env,
|
||||||
|
)->Some
|
||||||
|
| ("logScoreWithPointAnswer", [EvDistribution(prediction), EvNumber(answer)])
|
||||||
|
| (
|
||||||
|
"logScoreWithPointAnswer",
|
||||||
|
[EvDistribution(prediction), EvDistribution(Symbolic(#Float(answer)))],
|
||||||
|
) =>
|
||||||
|
DistributionOperation.run(FromDist(ToScore(LogScore(answer, None)), prediction), ~env)->Some
|
||||||
| ("isNormalized", [EvDistribution(dist)]) => Helpers.toBoolFn(IsNormalized, dist, ~env)
|
| ("isNormalized", [EvDistribution(dist)]) => Helpers.toBoolFn(IsNormalized, dist, ~env)
|
||||||
| ("toPointSet", [EvDistribution(dist)]) => Helpers.toDistFn(ToPointSet, dist, ~env)
|
| ("toPointSet", [EvDistribution(dist)]) => Helpers.toDistFn(ToPointSet, dist, ~env)
|
||||||
| ("scaleLog", [EvDistribution(dist)]) =>
|
| ("scaleLog", [EvDistribution(dist)]) =>
|
||||||
|
|
|
@ -623,6 +623,19 @@ module A = {
|
||||||
| Some(o) => o
|
| Some(o) => o
|
||||||
| None => []
|
| None => []
|
||||||
}
|
}
|
||||||
|
// REturns `None` there are no non-`None` elements
|
||||||
|
let rec arrSomeToSomeArr = (optionals: array<option<'a>>): option<array<'a>> => {
|
||||||
|
let optionals' = optionals->Belt.List.fromArray
|
||||||
|
switch optionals' {
|
||||||
|
| list{} => []->Some
|
||||||
|
| list{x, ...xs} =>
|
||||||
|
switch x {
|
||||||
|
| Some(_) => xs->Belt.List.toArray->arrSomeToSomeArr
|
||||||
|
| None => None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let firstSome = x => Belt.Array.getBy(x, O.isSome)
|
||||||
}
|
}
|
||||||
|
|
||||||
module R = {
|
module R = {
|
||||||
|
|
|
@ -55,8 +55,8 @@ type operationError =
|
||||||
| ComplexNumberError
|
| ComplexNumberError
|
||||||
| InfinityError
|
| InfinityError
|
||||||
| NegativeInfinityError
|
| NegativeInfinityError
|
||||||
| LogicallyInconsistentPathwayError
|
|
||||||
| SampleMapNeedsNtoNFunction
|
| SampleMapNeedsNtoNFunction
|
||||||
|
| PdfInvalidError
|
||||||
| NotYetImplemented // should be removed when `klDivergence` for mixed and discrete is implemented.
|
| NotYetImplemented // should be removed when `klDivergence` for mixed and discrete is implemented.
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
|
@ -70,8 +70,8 @@ module Error = {
|
||||||
| ComplexNumberError => "Operation returned complex result"
|
| ComplexNumberError => "Operation returned complex result"
|
||||||
| InfinityError => "Operation returned positive infinity"
|
| InfinityError => "Operation returned positive infinity"
|
||||||
| NegativeInfinityError => "Operation returned negative infinity"
|
| NegativeInfinityError => "Operation returned negative infinity"
|
||||||
| LogicallyInconsistentPathwayError => "This pathway should have been logically unreachable"
|
|
||||||
| SampleMapNeedsNtoNFunction => "SampleMap needs a function that converts a number to a number"
|
| SampleMapNeedsNtoNFunction => "SampleMap needs a function that converts a number to a number"
|
||||||
|
| PdfInvalidError => "This Pdf is invalid"
|
||||||
| NotYetImplemented => "This pathway is not yet implemented"
|
| NotYetImplemented => "This pathway is not yet implemented"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
40
packages/squiggle-lang/src/rescript/Utility/Stdlib.res
Normal file
40
packages/squiggle-lang/src/rescript/Utility/Stdlib.res
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
module Bernoulli = {
|
||||||
|
@module external cdf: (float, float) => float = "@stdlib/stats/base/dists/bernoulli/cdf"
|
||||||
|
let cdf = cdf
|
||||||
|
|
||||||
|
@module external pmf: (float, float) => float = "@stdlib/stats/base/dists/bernoulli/pmf"
|
||||||
|
let pmf = pmf
|
||||||
|
|
||||||
|
@module external quantile: (float, float) => float = "@stdlib/stats/base/dists/bernoulli/quantile"
|
||||||
|
let quantile = quantile
|
||||||
|
|
||||||
|
@module external mean: float => float = "@stdlib/stats/base/dists/bernoulli/mean"
|
||||||
|
let mean = mean
|
||||||
|
|
||||||
|
@module external stdev: float => float = "@stdlib/stats/base/dists/bernoulli/stdev"
|
||||||
|
let stdev = stdev
|
||||||
|
|
||||||
|
@module external variance: float => float = "@stdlib/stats/base/dists/bernoulli/variance"
|
||||||
|
let variance = variance
|
||||||
|
}
|
||||||
|
|
||||||
|
module Logistic = {
|
||||||
|
@module external cdf: (float, float, float) => float = "@stdlib/stats/base/dists/logistic/cdf"
|
||||||
|
let cdf = cdf
|
||||||
|
|
||||||
|
@module external pdf: (float, float, float) => float = "@stdlib/stats/base/dists/logistic/pdf"
|
||||||
|
let pdf = pdf
|
||||||
|
|
||||||
|
@module
|
||||||
|
external quantile: (float, float, float) => float = "@stdlib/stats/base/dists/logistic/quantile"
|
||||||
|
let quantile = quantile
|
||||||
|
|
||||||
|
@module external mean: (float, float) => float = "@stdlib/stats/base/dists/logistic/mean"
|
||||||
|
let mean = mean
|
||||||
|
|
||||||
|
@module external stdev: (float, float) => float = "@stdlib/stats/base/dists/logistic/stdev"
|
||||||
|
let stdev = stdev
|
||||||
|
|
||||||
|
@module external variance: (float, float) => float = "@stdlib/stats/base/dists/logistic/variance"
|
||||||
|
let variance = variance
|
||||||
|
}
|
|
@ -16,7 +16,7 @@
|
||||||
"@docusaurus/preset-classic": "2.0.0-beta.20",
|
"@docusaurus/preset-classic": "2.0.0-beta.20",
|
||||||
"@quri/squiggle-components": "^0.2.20",
|
"@quri/squiggle-components": "^0.2.20",
|
||||||
"clsx": "^1.1.1",
|
"clsx": "^1.1.1",
|
||||||
"prism-react-renderer": "^1.2.1",
|
"prism-react-renderer": "^1.3.3",
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.1.0",
|
||||||
"remark-math": "^3",
|
"remark-math": "^3",
|
||||||
|
|
355
yarn.lock
355
yarn.lock
|
@ -2502,6 +2502,335 @@
|
||||||
eval "^0.1.8"
|
eval "^0.1.8"
|
||||||
webpack-sources "^1.4.3"
|
webpack-sources "^1.4.3"
|
||||||
|
|
||||||
|
"@stdlib/array@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/array/-/array-0.0.12.tgz#12f40ab95bb36d424cdad991f29fc3cb491ee29e"
|
||||||
|
integrity sha512-nDksiuvRC1dSTHrf5yOGQmlRwAzSKV8MdFQwFSvLbZGGhi5Y4hExqea5HloLgNVouVs8lnAFi2oubSM4Mc7YAg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/blas" "^0.0.x"
|
||||||
|
"@stdlib/complex" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/assert@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/assert/-/assert-0.0.12.tgz#1648c9016e5041291f55a6464abcc4069c5103ce"
|
||||||
|
integrity sha512-38FxFf+ZoQZbdc+m09UsWtaCmzd/2e7im0JOaaFYE7icmRfm+4KiE9BRvBT4tIn7ioLB2f9PsBicKjIsf+tY1w==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/complex" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/ndarray" "^0.0.x"
|
||||||
|
"@stdlib/number" "^0.0.x"
|
||||||
|
"@stdlib/os" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/regexp" "^0.0.x"
|
||||||
|
"@stdlib/streams" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/bigint@^0.0.x":
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/bigint/-/bigint-0.0.11.tgz#c416a1d727001c55f4897e6424124199d638f2fd"
|
||||||
|
integrity sha512-uz0aYDLABAYyqxaCSHYbUt0yPkXYUCR7TrVvHN+UUD3i8FZ02ZKcLO+faKisDyxKEoSFTNtn3Ro8Ir5ebOlVXQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/blas@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/blas/-/blas-0.0.12.tgz#7e93e42b4621fc6903bf63264f045047333536c2"
|
||||||
|
integrity sha512-nWY749bWceuoWQ7gz977blCwR7lyQ/rsIXVO4b600h+NFpeA2i/ea7MYC680utIbeu2cnDWHdglBPoK535VAzA==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/number" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/buffer@^0.0.x":
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/buffer/-/buffer-0.0.11.tgz#6137b00845e6c905181cc7ebfae9f7e47c01b0ce"
|
||||||
|
integrity sha512-Jeie5eDDa1tVuRcuU+cBXI/oOXSmMxUUccZpqXzgYe0IO8QSNtNxv9mUTzJk/m5wH+lmLoDvNxzPpOH9TODjJg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/cli@^0.0.x":
|
||||||
|
version "0.0.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/cli/-/cli-0.0.10.tgz#28e2fbe6865d7f5cd15b7dc5846c99bd3b91674f"
|
||||||
|
integrity sha512-OITGaxG46kwK799+NuOd/+ccosJ9koVuQBC610DDJv0ZJf8mD7sbjGXrmue9C4EOh8MP7Vm/6HN14BojX8oTCg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
minimist "^1.2.0"
|
||||||
|
|
||||||
|
"@stdlib/complex@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/complex/-/complex-0.0.12.tgz#3afbc190cd0a9b37fc7c6e508c3aa9fda9106944"
|
||||||
|
integrity sha512-UbZBdaUxT2G+lsTIrVlRZwx2IRY6GXnVILggeejsIVxHSuK+oTyapfetcAv0FJFLP+Rrr+ZzrN4b9G3hBw6NHA==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/constants@^0.0.x":
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/constants/-/constants-0.0.11.tgz#78cd56d6c2982b30264843c3d75bde7125e90cd2"
|
||||||
|
integrity sha512-cWKy0L9hXHUQTvFzdPkTvZnn/5Pjv7H4UwY0WC1rLt+A5CxFDJKjvnIi9ypSzJS3CAiGl1ZaHCdadoqXhNdkUg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/number" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/fs@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/fs/-/fs-0.0.12.tgz#662365fd5846a51f075724b4f2888ae88441b70d"
|
||||||
|
integrity sha512-zcDLbt39EEM3M3wJW6luChS53B8T+TMJkjs2526UpKJ71O0/0adR57cI7PfCpkMd33d05uM7GM+leEj4eks4Cw==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
debug "^2.6.9"
|
||||||
|
|
||||||
|
"@stdlib/math@^0.0.x":
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/math/-/math-0.0.11.tgz#eb6638bc03a20fbd6727dd5b977ee0170bda4649"
|
||||||
|
integrity sha512-qI78sR1QqGjHj8k/aAqkZ51Su2fyBvaR/jMKQqcB/ML8bpYpf+QGlGvTty5Qdru/wpqds4kVFOVbWGcNFIV2+Q==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/ndarray" "^0.0.x"
|
||||||
|
"@stdlib/number" "^0.0.x"
|
||||||
|
"@stdlib/strided" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
debug "^2.6.9"
|
||||||
|
|
||||||
|
"@stdlib/ndarray@^0.0.x":
|
||||||
|
version "0.0.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/ndarray/-/ndarray-0.0.13.tgz#2e8fc645e10f56a645a0ab81598808c0e8f43b82"
|
||||||
|
integrity sha512-Z+U9KJP4U2HWrLtuAXSPvhNetAdqaNLMcliR6S/fz+VPlFDeymRK7omRFMgVQ+1zcAvIgKZGJxpLC3vjiPUYEw==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/bigint" "^0.0.x"
|
||||||
|
"@stdlib/buffer" "^0.0.x"
|
||||||
|
"@stdlib/complex" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/number" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/nlp@^0.0.x":
|
||||||
|
version "0.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/nlp/-/nlp-0.0.11.tgz#532ec0f7267b8d639e4c20c6de864e8de8a09054"
|
||||||
|
integrity sha512-D9avYWANm0Db2W7RpzdSdi5GxRYALGAqUrNnRnnKIO6sMEfr/DvONoAbWruda4QyvSC+0MJNwcEn7+PHhRwYhw==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/random" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/number@^0.0.x":
|
||||||
|
version "0.0.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/number/-/number-0.0.10.tgz#4030ad8fc3fac19a9afb415c443cee6deea0e65c"
|
||||||
|
integrity sha512-RyfoP9MlnX4kccvg8qv7vYQPbLdzfS1Mnp/prGOoWhvMG3pyBwFAan34kwFb5IS/zHC3W5EmrgXCV2QWyLg/Kg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/os" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/os@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/os/-/os-0.0.12.tgz#08bbf013c62a7153099fa9cbac086ca1349a4677"
|
||||||
|
integrity sha512-O7lklZ/9XEzoCmYvzjPh7jrFWkbpOSHGI71ve3dkSvBy5tyiSL3TtivfKsIC+9ZxuEJZ3d3lIjc9e+yz4HVbqQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/process@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/process/-/process-0.0.12.tgz#123325079d89a32f4212f72fb694f8fe3614cf18"
|
||||||
|
integrity sha512-P0X0TMvkissBE1Wr877Avi2/AxmP7X5Toa6GatHbpJdDg6jQmN4SgPd+NZNp98YtZUyk478c8XSIzMr1krQ20g==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/buffer" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/streams" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/random@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/random/-/random-0.0.12.tgz#e819c3abd602ed5559ba800dba751e49c633ff85"
|
||||||
|
integrity sha512-c5yND4Ahnm9Jx0I+jsKhn4Yrz10D53ALSrIe3PG1qIz3kNFcIPnmvCuNGd+3V4ch4Mbrez55Y8z/ZC5RJh4vJQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/blas" "^0.0.x"
|
||||||
|
"@stdlib/buffer" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/stats" "^0.0.x"
|
||||||
|
"@stdlib/streams" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
debug "^2.6.9"
|
||||||
|
readable-stream "^2.1.4"
|
||||||
|
|
||||||
|
"@stdlib/regexp@^0.0.x":
|
||||||
|
version "0.0.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/regexp/-/regexp-0.0.13.tgz#80b98361dc7a441b47bc3fa964bb0c826759e971"
|
||||||
|
integrity sha512-3JT5ZIoq/1nXY+dY+QtkU8/m7oWDeekyItEEXMx9c/AOf0ph8fmvTUGMDNfUq0RetcznFe3b66kFz6Zt4XHviA==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/stats@^0.0.13", "@stdlib/stats@^0.0.x":
|
||||||
|
version "0.0.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/stats/-/stats-0.0.13.tgz#87c973f385379d794707c7b5196a173dba8b07e1"
|
||||||
|
integrity sha512-hm+t32dKbx/L7+7WlQ1o4NDEzV0J4QSnwFBCsIMIAO8+VPxTZ4FxyNERl4oKlS3hZZe4AVKjoOVhBDtgEWrS4g==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/blas" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/ndarray" "^0.0.x"
|
||||||
|
"@stdlib/random" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/streams@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/streams/-/streams-0.0.12.tgz#07f5ceae5852590afad8e1cb7ce94174becc8739"
|
||||||
|
integrity sha512-YLUlXwjJNknHp92IkJUdvn5jEQjDckpawKhDLLCoxyh3h5V+w/8+61SH7TMTfKx5lBxKJ8vvtchZh90mIJOAjQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/buffer" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
debug "^2.6.9"
|
||||||
|
readable-stream "^2.1.4"
|
||||||
|
|
||||||
|
"@stdlib/strided@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/strided/-/strided-0.0.12.tgz#86ac48e660cb7f64a45cf07e80cbbfe58be21ae1"
|
||||||
|
integrity sha512-1NINP+Y7IJht34iri/bYLY7TVxrip51f6Z3qWxGHUCH33kvk5H5QqV+RsmFEGbbyoGtdeHrT2O+xA+7R2e3SNg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/ndarray" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/string@^0.0.x":
|
||||||
|
version "0.0.13"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/string/-/string-0.0.13.tgz#37457ca49e8d1dff0e523c68f5673c655c79eb2d"
|
||||||
|
integrity sha512-nGMHi7Qk9LBW0+Y+e3pSePQEBqyWH7+7DjFR1APcbsYccJE0p4aCaQdhPhx9Tp7j3uRGBmqPFek8wpcvIuC+CQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/nlp" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/regexp" "^0.0.x"
|
||||||
|
"@stdlib/streams" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/symbol@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/symbol/-/symbol-0.0.12.tgz#b9f396b0bf269c2985bb7fe99810a8e26d7288c3"
|
||||||
|
integrity sha512-2IDhpzWVGeLHgsvIsX12RXvf78r7xBkc4QLoRUv3k7Cp61BisR1Ym1p0Tq9PbxT8fknlvLToh9n5RpmESi2d4w==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/time@^0.0.x":
|
||||||
|
version "0.0.14"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/time/-/time-0.0.14.tgz#ea6daa438b1d3b019b99f5091117ee4bcef55d60"
|
||||||
|
integrity sha512-1gMFCQTabMVIgww+k4g8HHHIhyy1tIlvwT8mC0BHW7Q7TzDAgobwL0bvor+lwvCb5LlDAvNQEpaRgVT99QWGeQ==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/utils" "^0.0.x"
|
||||||
|
|
||||||
|
"@stdlib/types@^0.0.x":
|
||||||
|
version "0.0.14"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/types/-/types-0.0.14.tgz#02d3aab7a9bfaeb86e34ab749772ea22f7b2f7e0"
|
||||||
|
integrity sha512-AP3EI9/il/xkwUazcoY+SbjtxHRrheXgSbWZdEGD+rWpEgj6n2i63hp6hTOpAB5NipE0tJwinQlDGOuQ1lCaCw==
|
||||||
|
|
||||||
|
"@stdlib/utils@^0.0.x":
|
||||||
|
version "0.0.12"
|
||||||
|
resolved "https://registry.yarnpkg.com/@stdlib/utils/-/utils-0.0.12.tgz#670de5a7b253f04f11a4cba38f790e82393bcb46"
|
||||||
|
integrity sha512-+JhFpl6l7RSq/xGnbWRQ5dAL90h9ONj8MViqlb7teBZFtePZLMwoRA1wssypFcJ8SFMRWQn7lPmpYVUkGwRSOg==
|
||||||
|
dependencies:
|
||||||
|
"@stdlib/array" "^0.0.x"
|
||||||
|
"@stdlib/assert" "^0.0.x"
|
||||||
|
"@stdlib/blas" "^0.0.x"
|
||||||
|
"@stdlib/buffer" "^0.0.x"
|
||||||
|
"@stdlib/cli" "^0.0.x"
|
||||||
|
"@stdlib/constants" "^0.0.x"
|
||||||
|
"@stdlib/fs" "^0.0.x"
|
||||||
|
"@stdlib/math" "^0.0.x"
|
||||||
|
"@stdlib/os" "^0.0.x"
|
||||||
|
"@stdlib/process" "^0.0.x"
|
||||||
|
"@stdlib/random" "^0.0.x"
|
||||||
|
"@stdlib/regexp" "^0.0.x"
|
||||||
|
"@stdlib/streams" "^0.0.x"
|
||||||
|
"@stdlib/string" "^0.0.x"
|
||||||
|
"@stdlib/symbol" "^0.0.x"
|
||||||
|
"@stdlib/time" "^0.0.x"
|
||||||
|
"@stdlib/types" "^0.0.x"
|
||||||
|
debug "^2.6.9"
|
||||||
|
|
||||||
"@storybook/addon-actions@6.4.22", "@storybook/addon-actions@^6.4.22":
|
"@storybook/addon-actions@6.4.22", "@storybook/addon-actions@^6.4.22":
|
||||||
version "6.4.22"
|
version "6.4.22"
|
||||||
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-6.4.22.tgz#ec1b4332e76a8021dc0a1375dfd71a0760457588"
|
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-6.4.22.tgz#ec1b4332e76a8021dc0a1375dfd71a0760457588"
|
||||||
|
@ -4038,10 +4367,10 @@
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
form-data "^3.0.0"
|
form-data "^3.0.0"
|
||||||
|
|
||||||
"@types/node@*", "@types/node@^17.0.32", "@types/node@^17.0.5":
|
"@types/node@*", "@types/node@^17.0.33", "@types/node@^17.0.5":
|
||||||
version "17.0.32"
|
version "17.0.33"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.32.tgz#51d59d7a90ef2d0ae961791e0900cad2393a0149"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506"
|
||||||
integrity sha512-eAIcfAvhf/BkHcf4pkLJ7ECpBAhh9kcxRBpip9cTiO+hf+aJrsxYxBeS6OXvOd9WqNAJmavXVpZvY1rBjNsXmw==
|
integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==
|
||||||
|
|
||||||
"@types/node@^14.0.10":
|
"@types/node@^14.0.10":
|
||||||
version "14.18.16"
|
version "14.18.16"
|
||||||
|
@ -4108,10 +4437,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
||||||
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
||||||
|
|
||||||
"@types/react-dom@^18.0.0", "@types/react-dom@^18.0.2":
|
"@types/react-dom@^18.0.0", "@types/react-dom@^18.0.4":
|
||||||
version "18.0.3"
|
version "18.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.3.tgz#a022ea08c75a476fe5e96b675c3e673363853831"
|
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.4.tgz#dcbcadb277bcf6c411ceff70069424c57797d375"
|
||||||
integrity sha512-1RRW9kst+67gveJRYPxGmVy8eVJ05O43hg77G2j5m76/RFJtMbcfAs2viQ2UNsvvDg8F7OfQZx8qQcl6ymygaQ==
|
integrity sha512-FgTtbqPOCI3dzZPZoC2T/sx3L34qxy99ITWn4eoSA95qPyXDMH0ALoAqUp49ITniiJFsXUVBtalh/KffMpg21Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
|
@ -13678,10 +14007,10 @@ pretty-time@^1.1.0:
|
||||||
resolved "https://registry.yarnpkg.com/pretty-time/-/pretty-time-1.1.0.tgz#ffb7429afabb8535c346a34e41873adf3d74dd0e"
|
resolved "https://registry.yarnpkg.com/pretty-time/-/pretty-time-1.1.0.tgz#ffb7429afabb8535c346a34e41873adf3d74dd0e"
|
||||||
integrity sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==
|
integrity sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA==
|
||||||
|
|
||||||
prism-react-renderer@^1.2.1, prism-react-renderer@^1.3.1:
|
prism-react-renderer@^1.3.1, prism-react-renderer@^1.3.3:
|
||||||
version "1.3.1"
|
version "1.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.3.1.tgz#88fc9d0df6bed06ca2b9097421349f8c2f24e30d"
|
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.3.3.tgz#9b5a4211a6756eee3c96fee9a05733abc0b0805c"
|
||||||
integrity sha512-xUeDMEz074d0zc5y6rxiMp/dlC7C+5IDDlaEUlcBOFE2wddz7hz5PNupb087mPwTt7T9BrFmewObfCBuf/LKwQ==
|
integrity sha512-Viur/7tBTCH2HmYzwCHmt2rEFn+rdIWNIINXyg0StiISbDiIhHKhrFuEK8eMkKgvsIYSjgGqy/hNyucHp6FpoQ==
|
||||||
|
|
||||||
prismjs@^1.21.0, prismjs@^1.28.0:
|
prismjs@^1.21.0, prismjs@^1.28.0:
|
||||||
version "1.28.0"
|
version "1.28.0"
|
||||||
|
@ -14375,7 +14704,7 @@ read-pkg@^5.2.0:
|
||||||
parse-json "^5.0.0"
|
parse-json "^5.0.0"
|
||||||
type-fest "^0.6.0"
|
type-fest "^0.6.0"
|
||||||
|
|
||||||
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
|
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
|
||||||
version "2.3.7"
|
version "2.3.7"
|
||||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
||||||
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
|
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
|
||||||
|
|
Loading…
Reference in New Issue
Block a user