Simple lazy cdfs
This commit is contained in:
parent
320ed0d477
commit
4eb4247848
|
@ -16,6 +16,9 @@ module Value = {
|
||||||
| Probability(float)
|
| Probability(float)
|
||||||
| Conditional(conditional)
|
| Conditional(conditional)
|
||||||
| TimeLimitedDomainCdf(TimeLimitedDomainCdf.t)
|
| TimeLimitedDomainCdf(TimeLimitedDomainCdf.t)
|
||||||
|
| TimeLimitedDomainCdfLazy(
|
||||||
|
(string => Types.distribution) => TimeLimitedDomainCdf.t,
|
||||||
|
)
|
||||||
| ConditionalArray(array(conditional))
|
| ConditionalArray(array(conditional))
|
||||||
| FloatCdf(string);
|
| FloatCdf(string);
|
||||||
|
|
||||||
|
@ -29,6 +32,7 @@ module Value = {
|
||||||
| SelectSingle(r) => r
|
| SelectSingle(r) => r
|
||||||
| FloatCdf(r) => r
|
| FloatCdf(r) => r
|
||||||
| TimeLimitedDomainCdf(_) => ""
|
| TimeLimitedDomainCdf(_) => ""
|
||||||
|
| TimeLimitedDomainCdfLazy(_) => ""
|
||||||
| Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%"
|
| Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%"
|
||||||
| DateTime(r) => r |> MomentRe.Moment.defaultFormat
|
| DateTime(r) => r |> MomentRe.Moment.defaultFormat
|
||||||
| FloatPoint(r) => r |> Js.Float.toFixed
|
| FloatPoint(r) => r |> Js.Float.toFixed
|
||||||
|
@ -51,6 +55,10 @@ module Value = {
|
||||||
| SelectSingle(r) => r |> ReasonReact.string
|
| SelectSingle(r) => r |> ReasonReact.string
|
||||||
| ConditionalArray(r) => "Array" |> ReasonReact.string
|
| ConditionalArray(r) => "Array" |> ReasonReact.string
|
||||||
| Conditional(r) => r.name |> ReasonReact.string
|
| Conditional(r) => r.name |> ReasonReact.string
|
||||||
|
| TimeLimitedDomainCdfLazy(r) =>
|
||||||
|
let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000));
|
||||||
|
let cdf = timeLimited.limitedDomainCdf.distribution;
|
||||||
|
<> <Chart height=100 data={cdf |> Types.toJs} /> </>;
|
||||||
| TimeLimitedDomainCdf(r) =>
|
| TimeLimitedDomainCdf(r) =>
|
||||||
let cdf: Types.distribution = r.limitedDomainCdf.distribution;
|
let cdf: Types.distribution = r.limitedDomainCdf.distribution;
|
||||||
<> <Chart height=100 data={cdf |> Types.toJs} /> </>;
|
<> <Chart height=100 data={cdf |> Types.toJs} /> </>;
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
module Model = {
|
module Model = {
|
||||||
let make = (currentDateTime: MomentRe.Moment.t) => {
|
let make = (currentDateTime: MomentRe.Moment.t) => {
|
||||||
let yearsFromNow = "normal(50,30)";
|
let lazyDistribution = r =>
|
||||||
let dist = CdfLibrary.Distribution.fromString(yearsFromNow, 1000);
|
|
||||||
let timeLimitedDomain =
|
|
||||||
TimeLimitedDomainCdf.make(
|
TimeLimitedDomainCdf.make(
|
||||||
~timeVector={zero: currentDateTime, unit: `years},
|
~timeVector={zero: currentDateTime, unit: `years},
|
||||||
~distribution=dist,
|
~distribution=r("normal(50,30)"),
|
||||||
~probabilityAtMaxX=0.7,
|
~probabilityAtMaxX=0.7,
|
||||||
~maxX=`x(200.),
|
~maxX=`x(200.),
|
||||||
);
|
);
|
||||||
Prop.Value.TimeLimitedDomainCdf(timeLimitedDomain);
|
Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user