Last cleanup

Value: [1e-5 to 1e-3]
This commit is contained in:
Quinn Dougherty 2022-05-25 14:40:39 -04:00
parent 3aaad14f11
commit 6a9179d4b8
3 changed files with 2 additions and 24 deletions

View File

@ -300,12 +300,6 @@ module T = Dist({
| _ => XYShape.Analysis.getVarianceDangerously(t, mean, getMeanOfSquares)
}
}
// let klDivergence = (prediction: t, answer: t) => {
// let klDiscretePart = Discrete.T.klDivergence(prediction.discrete, answer.discrete)
// let klContinuousPart = Continuous.T.klDivergence(prediction.continuous, answer.continuous)
// E.R.merge(klDiscretePart, klContinuousPart)->E.R2.fmap(t => fst(t) +. snd(t))
// }
})
let combineAlgebraically = (op: Operation.convolutionOperation, t1: t, t2: t): t => {

View File

@ -34,9 +34,9 @@ module WithDistAnswer = {
Operation.Error.t,
> =>
switch (estimate, answer) {
| (Continuous(_), Continuous(_)) =>
| (Continuous(_), Continuous(_))
| (Discrete(_), Discrete(_)) =>
combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
| (Discrete(_), Discrete(_)) => combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
| (_, _) =>
let esti = estimate->toMixedFn
let answ = answer->toMixedFn

View File

@ -491,22 +491,6 @@ module PointwiseCombination = {
let newYs = E.A.fmap(x => XtoY.linear(x, t), newXs)
{xs: newXs, ys: newYs}
}
// This function is used for klDivergence
let combineAlongSupportOfSecondArgument: (
interpolator,
(float, float) => result<float, Operation.Error.t>,
T.t,
T.t,
) => result<T.t, Operation.Error.t> = (interpolator, fn, prediction, answer) => {
let combineWithFn = (answerX: float, i: int) => {
let answerY = answer.ys[i]
// let predictionY = XtoY.linear(answerX, prediction)
let predictionY = interpolator(prediction, i, answerX)
fn(predictionY, answerY)
}
let newYsWithError = Js.Array.mapi((x, i) => combineWithFn(x, i), answer.xs)
E.A.R.firstErrorOrOpen(newYsWithError)->E.R2.fmap(ys => {xs: answer.xs, ys: ys})
}
let addCombine = (interpolator: interpolator, t1: T.t, t2: T.t): T.t =>
combine(interpolator, (a, b) => Ok(a +. b), t1, t2)->E.R.toExn(