2022-04-08 18:42:14 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let defaultEnv: GenericDist.env
|
2022-04-29 22:51:00 +00:00
|
|
|
|
2022-04-22 20:27:17 +00:00
|
|
|
open DistributionTypes
|
2022-04-08 19:55:04 +00:00
|
|
|
|
2022-04-08 18:42:14 +00:00
|
|
|
@genType
|
2022-03-31 13:27:36 +00:00
|
|
|
type outputType =
|
2022-04-08 19:55:04 +00:00
|
|
|
| Dist(genericDist)
|
2022-03-31 13:27:36 +00:00
|
|
|
| Float(float)
|
|
|
|
| String(string)
|
2022-05-15 14:52:35 +00:00
|
|
|
| FloatArray(array<float>)
|
2022-04-15 17:58:00 +00:00
|
|
|
| Bool(bool)
|
2022-04-08 19:55:04 +00:00
|
|
|
| GenDistError(error)
|
2022-03-28 12:39:07 +00:00
|
|
|
|
2022-04-08 18:42:14 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let run: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
DistributionTypes.DistributionOperation.genericFunctionCallInfo,
|
|
|
|
) => outputType
|
2022-03-28 19:14:39 +00:00
|
|
|
let runFromDist: (
|
2022-07-13 16:37:39 +00:00
|
|
|
~env: GenericDist.env,
|
2022-04-22 20:27:17 +00:00
|
|
|
~functionCallInfo: DistributionTypes.DistributionOperation.fromDist,
|
2022-04-08 19:55:04 +00:00
|
|
|
genericDist,
|
2022-03-28 19:14:39 +00:00
|
|
|
) => outputType
|
2022-03-31 18:15:21 +00:00
|
|
|
let runFromFloat: (
|
2022-07-13 16:37:39 +00:00
|
|
|
~env: GenericDist.env,
|
2022-07-04 15:24:30 +00:00
|
|
|
~functionCallInfo: DistributionTypes.DistributionOperation.fromFloat,
|
2022-03-31 18:15:21 +00:00
|
|
|
float,
|
|
|
|
) => outputType
|
2022-03-28 19:14:39 +00:00
|
|
|
|
|
|
|
module Output: {
|
2022-03-31 17:26:29 +00:00
|
|
|
type t = outputType
|
2022-04-08 19:55:04 +00:00
|
|
|
let toDist: t => option<genericDist>
|
|
|
|
let toDistR: t => result<genericDist, error>
|
2022-03-31 17:26:29 +00:00
|
|
|
let toFloat: t => option<float>
|
2022-04-08 19:55:04 +00:00
|
|
|
let toFloatR: t => result<float, error>
|
2022-03-31 17:26:29 +00:00
|
|
|
let toString: t => option<string>
|
2022-04-08 19:55:04 +00:00
|
|
|
let toStringR: t => result<string, error>
|
2022-04-15 17:58:00 +00:00
|
|
|
let toBool: t => option<bool>
|
|
|
|
let toBoolR: t => result<bool, error>
|
2022-04-08 19:55:04 +00:00
|
|
|
let toError: t => option<error>
|
2022-07-13 16:37:39 +00:00
|
|
|
let fmap: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
t,
|
|
|
|
DistributionTypes.DistributionOperation.singleParamaterFunction,
|
|
|
|
) => t
|
2022-03-31 18:07:39 +00:00
|
|
|
}
|
2022-04-08 18:42:14 +00:00
|
|
|
|
|
|
|
module Constructors: {
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let mean: (~env: GenericDist.env, genericDist) => result<float, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let stdev: (~env: GenericDist.env, genericDist) => result<float, error>
|
2022-06-06 19:21:03 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let variance: (~env: GenericDist.env, genericDist) => result<float, error>
|
2022-06-06 19:21:03 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let sample: (~env: GenericDist.env, genericDist) => result<float, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let cdf: (~env: GenericDist.env, genericDist, float) => result<float, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let inv: (~env: GenericDist.env, genericDist, float) => result<float, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pdf: (~env: GenericDist.env, genericDist, float) => result<float, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let normalize: (~env: GenericDist.env, genericDist) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let isNormalized: (~env: GenericDist.env, genericDist) => result<bool, error>
|
2022-05-25 17:10:31 +00:00
|
|
|
module LogScore: {
|
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let distEstimateDistAnswer: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<float, error>
|
2022-05-25 17:10:31 +00:00
|
|
|
@genType
|
|
|
|
let distEstimateDistAnswerWithPrior: (
|
2022-07-13 16:37:39 +00:00
|
|
|
~env: GenericDist.env,
|
2022-05-25 17:10:31 +00:00
|
|
|
genericDist,
|
|
|
|
genericDist,
|
2022-07-12 16:45:41 +00:00
|
|
|
genericDist,
|
2022-05-25 17:10:31 +00:00
|
|
|
) => result<float, error>
|
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let distEstimateScalarAnswer: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
float,
|
|
|
|
) => result<float, error>
|
2022-05-25 17:10:31 +00:00
|
|
|
@genType
|
|
|
|
let distEstimateScalarAnswerWithPrior: (
|
2022-07-13 16:37:39 +00:00
|
|
|
~env: GenericDist.env,
|
2022-05-25 17:10:31 +00:00
|
|
|
genericDist,
|
|
|
|
float,
|
2022-07-12 16:45:41 +00:00
|
|
|
genericDist,
|
2022-05-25 17:10:31 +00:00
|
|
|
) => result<float, error>
|
|
|
|
}
|
2022-04-29 00:24:13 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let toPointSet: (~env: GenericDist.env, genericDist) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let toSampleSet: (~env: GenericDist.env, genericDist, int) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let fromSamples: (~env: GenericDist.env, SampleSetDist.t) => result<genericDist, error>
|
2022-04-29 22:38:55 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let truncate: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
option<float>,
|
|
|
|
option<float>,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let inspect: (~env: GenericDist.env, genericDist) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let toString: (~env: GenericDist.env, genericDist) => result<string, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let toSparkline: (~env: GenericDist.env, genericDist, int) => result<string, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicAdd: (~env: GenericDist.env, genericDist, genericDist) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicMultiply: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicDivide: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicSubtract: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicLogarithm: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let algebraicPower: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let scaleLogarithm: (~env: GenericDist.env, genericDist, float) => result<genericDist, error>
|
2022-05-02 21:15:23 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let scaleMultiply: (~env: GenericDist.env, genericDist, float) => result<genericDist, error>
|
2022-06-17 13:44:06 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let scalePower: (~env: GenericDist.env, genericDist, float) => result<genericDist, error>
|
2022-05-02 21:15:23 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwiseAdd: (~env: GenericDist.env, genericDist, genericDist) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwiseMultiply: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwiseDivide: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwiseSubtract: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwiseLogarithm: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-12 23:59:40 +00:00
|
|
|
@genType
|
2022-07-13 16:37:39 +00:00
|
|
|
let pointwisePower: (
|
|
|
|
~env: GenericDist.env,
|
|
|
|
genericDist,
|
|
|
|
genericDist,
|
|
|
|
) => result<genericDist, error>
|
2022-04-08 18:42:14 +00:00
|
|
|
}
|