From 2ab395b4e5ff727f08826b3c470b024b51ef3104 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 12 May 2022 16:03:29 -0400 Subject: [PATCH] Some minor CR Value: [1e-10 to 1e-4] --- .../src/rescript/Distributions/GenericDist.res | 8 ++++---- .../rescript/Distributions/PointSetDist/PointSetDist.res | 3 --- .../ReducerInterface_GenericDistribution.res | 5 ++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res index 1995ef34..3e067c51 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res @@ -60,10 +60,10 @@ let integralEndY = (t: t): float => let isNormalized = (t: t): bool => Js.Math.abs_float(integralEndY(t) -. 1.0) < 1e-7 module Score = { - let klDivergence = (t1, t2, ~toPointSetFn: toPointSetFn): result => { - let pointSets = E.R.merge(toPointSetFn(t1), toPointSetFn(t2)) - pointSets |> E.R2.bind(((a, b)) => - PointSetDist.T.klDivergence(a, b)->E.R2.errMap(x => DistributionTypes.OperationError(x)) + let klDivergence = (prediction, answer, ~toPointSetFn: toPointSetFn): result => { + let pointSets = E.R.merge(toPointSetFn(prediction), toPointSetFn(answer)) + pointSets |> E.R2.bind(((predi, ans)) => + PointSetDist.T.klDivergence(predi, ans)->E.R2.errMap(x => DistributionTypes.OperationError(x)) ) } diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res index 05e79830..2f8ebee3 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res @@ -209,9 +209,6 @@ module T = Dist({ | _ => Error(Operation.NotYetImplemented) } } - let logScoreAgainstImproperPrior = (prediction: t, answer: float) => { - Error(Operation.NotYetImplemented) - } }) let pdf = (f: float, t: t) => { diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res index b7f5f824..fb26189f 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res @@ -169,7 +169,10 @@ module Helpers = { E.A.Floats.range(a, b, MagicNumbers.Environment.defaultXYPointLength) | _ => [] } - {xs: xs, ys: E.A.fmap(fn, xs)}->Continuous.make->Continuous->DistributionTypes.PointSet + {xs: xs, ys: E.A.fmap(fn, xs)} + ->Continuous.make + ->PointSetTypes.Continuous + ->DistributionTypes.PointSet } }