squiggle/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.resi

186 lines
5.1 KiB
Plaintext
Raw Normal View History

@genType
2022-07-13 16:37:39 +00:00
let defaultEnv: GenericDist.env
open DistributionTypes
2022-04-08 19:55:04 +00:00
@genType
type outputType =
2022-04-08 19:55:04 +00:00
| Dist(genericDist)
| Float(float)
| String(string)
2022-05-15 14:52:35 +00:00
| FloatArray(array<float>)
| Bool(bool)
2022-04-08 19:55:04 +00:00
| GenDistError(error)
2022-03-28 12:39:07 +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,
~functionCallInfo: DistributionTypes.DistributionOperation.fromDist,
2022-04-08 19:55:04 +00:00
genericDist,
2022-03-28 19:14:39 +00:00
) => outputType
let runFromFloat: (
2022-07-13 16:37:39 +00:00
~env: GenericDist.env,
~functionCallInfo: DistributionTypes.DistributionOperation.fromFloat,
float,
) => outputType
2022-03-28 19:14:39 +00:00
module Output: {
type t = outputType
2022-04-08 19:55:04 +00:00
let toDist: t => option<genericDist>
let toDistR: t => result<genericDist, error>
let toFloat: t => option<float>
2022-04-08 19:55:04 +00:00
let toFloatR: t => result<float, error>
let toString: t => option<string>
2022-04-08 19:55:04 +00:00
let toStringR: t => result<string, error>
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
}
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>
@genType
2022-07-13 16:37:39 +00:00
let variance: (~env: GenericDist.env, genericDist) => result<float, error>
@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>
module LogScore: {
@genType
2022-07-13 16:37:39 +00:00
let distEstimateDistAnswer: (
~env: GenericDist.env,
genericDist,
genericDist,
) => result<float, error>
@genType
let distEstimateDistAnswerWithPrior: (
2022-07-13 16:37:39 +00:00
~env: GenericDist.env,
genericDist,
genericDist,
2022-07-12 16:45:41 +00:00
genericDist,
) => result<float, error>
@genType
2022-07-13 16:37:39 +00:00
let distEstimateScalarAnswer: (
~env: GenericDist.env,
genericDist,
float,
) => result<float, error>
@genType
let distEstimateScalarAnswerWithPrior: (
2022-07-13 16:37:39 +00:00
~env: GenericDist.env,
genericDist,
float,
2022-07-12 16:45:41 +00:00
genericDist,
) => 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>
@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>
@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>
@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>
}