SymbolicDistFloat adjustment for choose in ExpressionTree

This commit is contained in:
Ozzie Gooen 2020-07-19 23:08:27 +01:00
parent 95b8ba2036
commit ac7b1ee9d5
2 changed files with 8 additions and 6 deletions

View File

@ -180,10 +180,10 @@ let make = () => {
unitType: "UnspecifiedDistribution", unitType: "UnspecifiedDistribution",
zero: MomentRe.momentNow(), zero: MomentRe.momentNow(),
unit: "days", unit: "days",
sampleCount: "3000", sampleCount: "30000",
outputXYPoints: "100", outputXYPoints: "1000",
downsampleTo: "100", downsampleTo: "",
kernelWidth: "5", kernelWidth: "",
}, },
(), (),
); );

View File

@ -36,6 +36,8 @@ module AlgebraicCombination = {
let dLength = (r: DistTypes.discreteShape) => let dLength = (r: DistTypes.discreteShape) =>
r.xyShape |> XYShape.T.length; r.xyShape |> XYShape.T.length;
switch (t1, t2) { switch (t1, t2) {
| (`SymbolicDist(`Float(_)), _)
| (_, `SymbolicDist(`Float(_))) => `Analytical
| (`RenderedDist(Continuous(_)), `RenderedDist(Continuous(_))) => `Sampling | (`RenderedDist(Continuous(_)), `RenderedDist(Continuous(_))) => `Sampling
| (`RenderedDist(Discrete(m1)), `RenderedDist(Discrete(m2))) | (`RenderedDist(Discrete(m1)), `RenderedDist(Discrete(m2)))
when dLength(m1) * dLength(m2) > 1000 => `Analytical when dLength(m1) * dLength(m2) > 1000 => `Analytical
@ -48,7 +50,7 @@ module AlgebraicCombination = {
| _ => `Sampling | _ => `Sampling
}; };
}; };
let foo = let combine =
(evaluationParams, algebraicOp, t1: node, t2: node) (evaluationParams, algebraicOp, t1: node, t2: node)
: result(node, string) => { : result(node, string) => {
E.R.merge( E.R.merge(
@ -90,7 +92,7 @@ module AlgebraicCombination = {
_, _,
fun fun
| `SymbolicDist(_) as t => Ok(t) | `SymbolicDist(_) as t => Ok(t)
| _ => foo(evaluationParams, algebraicOp, t1, t2), | _ => combine(evaluationParams, algebraicOp, t1, t2),
); );
}; };