Merge pull request #321 from quantified-uncertainty/cauchy

hotfix: `cauchy` in binary dist constructors
This commit is contained in:
Ozzie Gooen 2022-04-20 12:26:25 -04:00 committed by GitHub
commit 6c43907ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -2,3 +2,5 @@ dist
lib
*.bs.js
*.gen.tsx
.nyc_output/
coverage/

View File

@ -86,7 +86,9 @@ module Exponential = {
module Cauchy = {
type t = cauchy
let make = (local, scale): symbolicDist => #Cauchy({local: local, scale: scale})
let make = (local, scale): result<symbolicDist, string> => Ok(
#Cauchy({local: local, scale: scale}),
)
let pdf = (x, t: t) => Jstat.Cauchy.pdf(x, t.local, t.scale)
let cdf = (x, t: t) => Jstat.Cauchy.cdf(x, t.local, t.scale)
let inv = (p, t: t) => Jstat.Cauchy.inv(p, t.local, t.scale)

View File

@ -149,6 +149,7 @@ module SymbolicConstructors = {
| "uniform" => Ok(SymbolicDist.Uniform.make)
| "beta" => Ok(SymbolicDist.Beta.make)
| "lognormal" => Ok(SymbolicDist.Lognormal.make)
| "cauchy" => Ok(SymbolicDist.Cauchy.make)
| "to" => Ok(SymbolicDist.From90thPercentile.make)
| _ => Error("Unreachable state")
}
@ -182,7 +183,7 @@ let dispatchToGenericOutput = (call: ExpressionValue.functionCall): option<
->E.R.bind(r => r(f1))
->SymbolicConstructors.symbolicResultToOutput
| (
("normal" | "uniform" | "beta" | "lognormal" | "to") as fnName,
("normal" | "uniform" | "beta" | "lognormal" | "cauchy" | "to") as fnName,
[EvNumber(f1), EvNumber(f2)],
) =>
SymbolicConstructors.twoFloat(fnName)