Some minor CR
Value: [1e-10 to 1e-4]
This commit is contained in:
parent
65751e590a
commit
2ab395b4e5
|
@ -60,10 +60,10 @@ let integralEndY = (t: t): float =>
|
||||||
let isNormalized = (t: t): bool => Js.Math.abs_float(integralEndY(t) -. 1.0) < 1e-7
|
let isNormalized = (t: t): bool => Js.Math.abs_float(integralEndY(t) -. 1.0) < 1e-7
|
||||||
|
|
||||||
module Score = {
|
module Score = {
|
||||||
let klDivergence = (t1, t2, ~toPointSetFn: toPointSetFn): result<float, error> => {
|
let klDivergence = (prediction, answer, ~toPointSetFn: toPointSetFn): result<float, error> => {
|
||||||
let pointSets = E.R.merge(toPointSetFn(t1), toPointSetFn(t2))
|
let pointSets = E.R.merge(toPointSetFn(prediction), toPointSetFn(answer))
|
||||||
pointSets |> E.R2.bind(((a, b)) =>
|
pointSets |> E.R2.bind(((predi, ans)) =>
|
||||||
PointSetDist.T.klDivergence(a, b)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
PointSetDist.T.klDivergence(predi, ans)->E.R2.errMap(x => DistributionTypes.OperationError(x))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,9 +209,6 @@ module T = Dist({
|
||||||
| _ => Error(Operation.NotYetImplemented)
|
| _ => Error(Operation.NotYetImplemented)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let logScoreAgainstImproperPrior = (prediction: t, answer: float) => {
|
|
||||||
Error(Operation.NotYetImplemented)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
let pdf = (f: float, t: t) => {
|
let pdf = (f: float, t: t) => {
|
||||||
|
|
|
@ -169,7 +169,10 @@ module Helpers = {
|
||||||
E.A.Floats.range(a, b, MagicNumbers.Environment.defaultXYPointLength)
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user