Last cleanup
Value: [1e-5 to 1e-3]
This commit is contained in:
parent
3aaad14f11
commit
6a9179d4b8
|
@ -300,12 +300,6 @@ module T = Dist({
|
||||||
| _ => XYShape.Analysis.getVarianceDangerously(t, mean, getMeanOfSquares)
|
| _ => 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 => {
|
let combineAlgebraically = (op: Operation.convolutionOperation, t1: t, t2: t): t => {
|
||||||
|
|
|
@ -34,9 +34,9 @@ module WithDistAnswer = {
|
||||||
Operation.Error.t,
|
Operation.Error.t,
|
||||||
> =>
|
> =>
|
||||||
switch (estimate, answer) {
|
switch (estimate, answer) {
|
||||||
| (Continuous(_), Continuous(_)) =>
|
| (Continuous(_), Continuous(_))
|
||||||
|
| (Discrete(_), Discrete(_)) =>
|
||||||
combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
|
combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
|
||||||
| (Discrete(_), Discrete(_)) => combineFn(integrand, estimate, answer)->E.R2.fmap(integrateFn)
|
|
||||||
| (_, _) =>
|
| (_, _) =>
|
||||||
let esti = estimate->toMixedFn
|
let esti = estimate->toMixedFn
|
||||||
let answ = answer->toMixedFn
|
let answ = answer->toMixedFn
|
||||||
|
|
|
@ -491,22 +491,6 @@ module PointwiseCombination = {
|
||||||
let newYs = E.A.fmap(x => XtoY.linear(x, t), newXs)
|
let newYs = E.A.fmap(x => XtoY.linear(x, t), newXs)
|
||||||
{xs: newXs, ys: newYs}
|
{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 =>
|
let addCombine = (interpolator: interpolator, t1: T.t, t2: T.t): T.t =>
|
||||||
combine(interpolator, (a, b) => Ok(a +. b), t1, t2)->E.R.toExn(
|
combine(interpolator, (a, b) => Ok(a +. b), t1, t2)->E.R.toExn(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user