Minor fixes
This commit is contained in:
parent
82595ae167
commit
58c6c165f3
|
@ -1,14 +1,17 @@
|
||||||
let truncateIfShould =
|
let truncateIfShould =
|
||||||
(
|
(
|
||||||
{recommendedLength, shouldTruncate}: RenderTypes.DistPlusRenderer.inputs,
|
{recommendedLength, shouldTruncate}: RenderTypes.DistPlusRenderer.inputs,
|
||||||
{sampling:shape}: RenderTypes.ShapeRenderer.Combined.outputs,
|
outputs: RenderTypes.ShapeRenderer.Combined.outputs,
|
||||||
dist,
|
dist,
|
||||||
) => {
|
) => {
|
||||||
(shouldTruncate && (shape |> E.O.isSome))
|
shouldTruncate
|
||||||
|
&& RenderTypes.ShapeRenderer.Combined.methodUsed(outputs) == `Sampling
|
||||||
? dist |> Distributions.DistPlus.T.truncate(recommendedLength) : dist;
|
? dist |> Distributions.DistPlus.T.truncate(recommendedLength) : dist;
|
||||||
};
|
};
|
||||||
|
|
||||||
let run = (inputs: RenderTypes.DistPlusRenderer.inputs): RenderTypes.DistPlusRenderer.outputs => {
|
let run =
|
||||||
|
(inputs: RenderTypes.DistPlusRenderer.inputs)
|
||||||
|
: RenderTypes.DistPlusRenderer.outputs => {
|
||||||
let toDist = shape =>
|
let toDist = shape =>
|
||||||
Distributions.DistPlus.make(
|
Distributions.DistPlus.make(
|
||||||
~shape,
|
~shape,
|
||||||
|
@ -25,9 +28,9 @@ let run = (inputs: RenderTypes.DistPlusRenderer.inputs): RenderTypes.DistPlusRen
|
||||||
symbolicInputs: {
|
symbolicInputs: {
|
||||||
length: inputs.recommendedLength,
|
length: inputs.recommendedLength,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
let shape = outputs |> RenderTypes.ShapeRenderer.Combined.getShape
|
let shape = outputs |> RenderTypes.ShapeRenderer.Combined.getShape;
|
||||||
let dist =
|
let dist =
|
||||||
shape |> E.O.fmap(toDist) |> E.O.fmap(truncateIfShould(inputs, outputs));
|
shape |> E.O.fmap(toDist) |> E.O.fmap(truncateIfShould(inputs, outputs));
|
||||||
RenderTypes.DistPlusRenderer.Outputs.make(outputs, dist)
|
RenderTypes.DistPlusRenderer.Outputs.make(outputs, dist);
|
||||||
};
|
};
|
|
@ -59,6 +59,11 @@ module ShapeRenderer = {
|
||||||
symbolic: option(Belt.Result.t(Symbolic.outputs, string)),
|
symbolic: option(Belt.Result.t(Symbolic.outputs, string)),
|
||||||
sampling: option(Sampling.outputs),
|
sampling: option(Sampling.outputs),
|
||||||
};
|
};
|
||||||
|
let methodUsed = ({symbolic, sampling}:outputs) => switch(symbolic, sampling){
|
||||||
|
| (Some(Ok(_)), _) => `Symbolic
|
||||||
|
| (None, Some({shape: Some(_)})) => `Sampling
|
||||||
|
| _ => `None
|
||||||
|
}
|
||||||
let getShape = (r: outputs) =>
|
let getShape = (r: outputs) =>
|
||||||
switch (r.symbolic, r.sampling) {
|
switch (r.symbolic, r.sampling) {
|
||||||
| (Some(Ok({shape})), _) => Some(shape)
|
| (Some(Ok({shape})), _) => Some(shape)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user