Fixed tests (plausibly slightly naively)

Value: [1e-4 to 1e-1]
This commit is contained in:
Quinn Dougherty 2022-05-25 13:38:55 -04:00
parent cbaf4c150d
commit a266b8ed09
2 changed files with 20 additions and 5 deletions

View File

@ -306,9 +306,6 @@ module T = Dist({
// let klContinuousPart = Continuous.T.klDivergence(prediction.continuous, answer.continuous)
// E.R.merge(klDiscretePart, klContinuousPart)->E.R2.fmap(t => fst(t) +. snd(t))
// }
// let logScoreWithPointResolution = (~prediction: t, ~answer: float, ~prior: option<t>) => {
// Error(Operation.NotYetImplemented)
// }
})
let combineAlgebraically = (op: Operation.convolutionOperation, t1: t, t2: t): t => {

View File

@ -29,8 +29,26 @@ module WithDistAnswer = {
minusScaledLogOfQuot(~esti=estimateElement, ~answ=answerElement)
}
let sum = (~estimate: t, ~answer: t, ~combineFn, ~integrateFn) =>
combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
let rec sum = (~estimate: t, ~answer: t, ~combineFn, ~integrateFn) =>
switch (estimate, answer) {
| ((Continuous(_) | Discrete(_)) as esti, (Continuous(_) | Discrete(_)) as answ) =>
combineFn(integrand, esti, answ)->E.R2.fmap(integrateFn)
| (Mixed(esti), Mixed(answ)) =>
E.R.merge(
sum(
~estimate=Discrete(esti.discrete),
~answer=Discrete(answ.discrete),
~combineFn,
~integrateFn,
),
sum(
~estimate=Continuous(esti.continuous),
~answer=Continuous(answ.continuous),
~combineFn,
~integrateFn,
),
)->E.R2.fmap(((discretePart, continuousPart)) => discretePart +. continuousPart)
}
let sumWithPrior = (~estimate: t, ~answer: t, ~prior: t, ~combineFn, ~integrateFn): result<
float,