2022-04-08 18:42:14 +00:00
|
|
|
@genType
|
2022-03-31 18:07:39 +00:00
|
|
|
type env = {
|
2022-03-28 12:39:07 +00:00
|
|
|
sampleCount: int,
|
|
|
|
xyPointLength: int,
|
|
|
|
}
|
|
|
|
|
2022-04-29 22:51:00 +00:00
|
|
|
@genType
|
|
|
|
let defaultEnv: env
|
|
|
|
|
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-04-22 20:27:17 +00:00
|
|
|
let run: (~env: env, DistributionTypes.DistributionOperation.genericFunctionCallInfo) => outputType
|
2022-03-28 19:14:39 +00:00
|
|
|
let runFromDist: (
|
2022-03-31 18:07:39 +00:00
|
|
|
~env: 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: (
|
|
|
|
~env: env,
|
2022-04-22 20:27:17 +00:00
|
|
|
~functionCallInfo: DistributionTypes.DistributionOperation.fromDist,
|
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-04-22 20:27:17 +00:00
|
|
|
let fmap: (~env: 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
|
|
|
|
let mean: (~env: env, genericDist) => result<float, error>
|
|
|
|
@genType
|
|
|
|
let sample: (~env: env, genericDist) => result<float, error>
|
|
|
|
@genType
|
|
|
|
let cdf: (~env: env, genericDist, float) => result<float, error>
|
|
|
|
@genType
|
|
|
|
let inv: (~env: env, genericDist, float) => result<float, error>
|
|
|
|
@genType
|
|
|
|
let pdf: (~env: env, genericDist, float) => result<float, error>
|
|
|
|
@genType
|
|
|
|
let normalize: (~env: env, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
2022-04-15 17:58:00 +00:00
|
|
|
let isNormalized: (~env: env, genericDist) => result<bool, error>
|
|
|
|
@genType
|
2022-05-05 19:37:28 +00:00
|
|
|
let klDivergence: (~env: env, genericDist, genericDist) => result<float, error>
|
2022-05-12 18:16:52 +00:00
|
|
|
@genType
|
2022-05-13 20:15:04 +00:00
|
|
|
let logScoreWithPointResolution: (
|
|
|
|
~env: env,
|
|
|
|
genericDist,
|
|
|
|
float,
|
|
|
|
option<genericDist>,
|
|
|
|
) => result<float, error>
|
2022-04-29 00:24:13 +00:00
|
|
|
@genType
|
2022-04-12 23:59:40 +00:00
|
|
|
let toPointSet: (~env: env, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let toSampleSet: (~env: env, genericDist, int) => result<genericDist, error>
|
|
|
|
@genType
|
2022-04-29 22:38:55 +00:00
|
|
|
let fromSamples: (~env: env, SampleSetDist.t) => result<genericDist, error>
|
|
|
|
@genType
|
2022-04-12 23:59:40 +00:00
|
|
|
let truncate: (~env: env, genericDist, option<float>, option<float>) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let inspect: (~env: env, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let toString: (~env: env, genericDist) => result<string, error>
|
|
|
|
@genType
|
|
|
|
let toSparkline: (~env: env, genericDist, int) => result<string, error>
|
|
|
|
@genType
|
|
|
|
let algebraicAdd: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let algebraicMultiply: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let algebraicDivide: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let algebraicSubtract: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let algebraicLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let algebraicPower: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
2022-05-02 21:15:23 +00:00
|
|
|
let scaleLogarithm: (~env: env, genericDist, float) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let scalePower: (~env: env, genericDist, float) => result<genericDist, error>
|
|
|
|
@genType
|
2022-04-12 23:59:40 +00:00
|
|
|
let pointwiseAdd: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let pointwiseMultiply: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let pointwiseDivide: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let pointwiseSubtract: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let pointwiseLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
|
|
|
@genType
|
|
|
|
let pointwisePower: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
2022-04-08 18:42:14 +00:00
|
|
|
}
|