Fixed mass-ratio of continuous vs. discrete
This commit is contained in:
parent
67ee34d821
commit
a940fa30b7
|
@ -24,7 +24,7 @@ let distributions = () =>
|
|||
<h2> {"Single-Discrete" |> ReasonReact.string} </h2>
|
||||
{setup(
|
||||
DistPlusIngredients.make(
|
||||
~guesstimatorString="mm(5 to 20, floor(normal(20,2)), [.5, .05])",
|
||||
~guesstimatorString="mm(5 to 20, floor(normal(20,2)), [.5, .5])",
|
||||
~domain=Complete,
|
||||
(),
|
||||
),
|
||||
|
|
|
@ -77,6 +77,9 @@ let make = (~distPlus: DistTypes.distPlus) => {
|
|||
<th className="px-4 py-2">
|
||||
{"Y Integral to Point" |> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2">
|
||||
{"Y Integral Total" |> ReasonReact.string}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -104,12 +107,73 @@ let make = (~distPlus: DistTypes.distPlus) => {
|
|||
|> E.Float.with2DigitsPrecision
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table className="table-auto">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="px-4 py-2">
|
||||
{"Y Integral Total" |> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2">
|
||||
{"Continuous Total" |> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2">
|
||||
{"Scaled Continuous Total" |> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2">
|
||||
{"Discrete Total" |> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2">
|
||||
{"Scaled Discrete Total" |> ReasonReact.string}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th className="px-4 py-2 border ">
|
||||
{distPlus
|
||||
|> Distributions.DistPlus.T.Integral.sum(~cache=None)
|
||||
|> E.Float.with2DigitsPrecision
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2 border ">
|
||||
{distPlus
|
||||
|> Distributions.DistPlus.T.toContinuous
|
||||
|> E.O.fmap(
|
||||
Distributions.Continuous.T.Integral.sum(~cache=None),
|
||||
)
|
||||
|> E.O.fmap(E.Float.with2DigitsPrecision)
|
||||
|> E.O.default("")
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2 border ">
|
||||
{distPlus
|
||||
|> Distributions.DistPlus.T.toScaledContinuous
|
||||
|> E.O.fmap(
|
||||
Distributions.Continuous.T.Integral.sum(~cache=None),
|
||||
)
|
||||
|> E.O.fmap(E.Float.with2DigitsPrecision)
|
||||
|> E.O.default("")
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2 border ">
|
||||
{distPlus
|
||||
|> Distributions.DistPlus.T.toDiscrete
|
||||
|> E.O.fmap(Distributions.Discrete.T.Integral.sum(~cache=None))
|
||||
|> E.O.fmap(E.Float.with2DigitsPrecision)
|
||||
|> E.O.default("")
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
<th className="px-4 py-2 border ">
|
||||
{distPlus
|
||||
|> Distributions.DistPlus.T.toScaledDiscrete
|
||||
|> E.O.fmap(Distributions.Discrete.T.Integral.sum(~cache=None))
|
||||
|> E.O.fmap(E.Float.with2DigitsPrecision)
|
||||
|> E.O.default("")
|
||||
|> ReasonReact.string}
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -191,21 +191,6 @@ module Mixed = {
|
|||
discreteProbabilityMassFraction,
|
||||
};
|
||||
|
||||
let clean = (t: DistTypes.mixedShape): option(DistTypes.shape) => {
|
||||
switch (t) {
|
||||
| {
|
||||
continuous: {xyShape: {xs: [||], ys: [||]}},
|
||||
discrete: {xs: [||], ys: [||]},
|
||||
} =>
|
||||
None
|
||||
| {continuous, discrete: {xs: [||], ys: [||]}} =>
|
||||
Some(Continuous(continuous))
|
||||
| {continuous: {xyShape: {xs: [||], ys: [||]}}, discrete} =>
|
||||
Some(Discrete(discrete))
|
||||
| shape => Some(Mixed(shape))
|
||||
};
|
||||
};
|
||||
|
||||
// todo: Put into scaling module
|
||||
let scaleDiscreteFn =
|
||||
({discreteProbabilityMassFraction}: DistTypes.mixedShape, f) =>
|
||||
|
|
|
@ -21,16 +21,21 @@ let buildSimple = (~continuous, ~discrete): option(DistTypes.shape) => {
|
|||
Distributions.Discrete.T.Integral.sum(~cache=None, discrete);
|
||||
let discrete =
|
||||
Distributions.Discrete.T.scaleToIntegralSum(~intendedSum=1.0, discrete);
|
||||
let foobar =
|
||||
let continuous =
|
||||
Distributions.Continuous.T.scaleToIntegralSum(
|
||||
~intendedSum=1.0,
|
||||
continuous,
|
||||
);
|
||||
let mixedDist =
|
||||
Distributions.Mixed.make(
|
||||
~continuous,
|
||||
~discrete,
|
||||
~discreteProbabilityMassFraction,
|
||||
)
|
||||
|> Distributions.Mixed.clean;
|
||||
foobar;
|
||||
);
|
||||
Some(Mixed(mixedDist));
|
||||
};
|
||||
};
|
||||
|
||||
let build = (~continuous, ~discrete, ~assumptions) =>
|
||||
switch (assumptions) {
|
||||
| {
|
||||
|
|
Loading…
Reference in New Issue
Block a user