Dist-builder-2-adjustments

This commit is contained in:
Ozzie Gooen 2020-03-21 10:49:26 +00:00
parent 8d1ab10e06
commit 0e0f0221e9
3 changed files with 27 additions and 15 deletions

View File

@ -36,13 +36,25 @@ module DemoDist = {
let make = (~guesstimatorString: string) => { let make = (~guesstimatorString: string) => {
let (ys, xs, isEmpty) = let (ys, xs, isEmpty) =
DistEditor.getPdfFromUserInput(guesstimatorString); DistEditor.getPdfFromUserInput(guesstimatorString);
let continuous: DistTypes.xyShape = {xs, ys}; let inside =
isEmpty
? "Nothing to show" |> E.ste
: {
let distPlus =
Distributions.DistPlus.make(
~shape=
Continuous(Distributions.Continuous.fromShape({xs, ys})),
~domain=Complete,
~unit=UnspecifiedDistribution,
~guesstimatorString=None,
(),
)
|> Distributions.DistPlus.T.scaleToIntegralSum(~intendedSum=1.0);
<DistPlusPlot distPlus />;
};
<Antd.Card title={"Distribution" |> E.ste}> <Antd.Card title={"Distribution" |> E.ste}>
<div className=Styles.spacer /> <div className=Styles.spacer />
{isEmpty inside
? "Nothing to show. Try to change the distribution description."
|> E.ste
: <DistributionPlot continuous />}
</Antd.Card>; </Antd.Card>;
}; };
}; };
@ -54,7 +66,7 @@ let make = () => {
~validationStrategy=OnDemand, ~validationStrategy=OnDemand,
~schema, ~schema,
~onSubmit=({state}) => {None}, ~onSubmit=({state}) => {None},
~initialState={guesstimatorString: "normal(1, 1) / normal(10, 1)"}, ~initialState={guesstimatorString: "lognormal(6.1, 1)"},
(), (),
); );
@ -88,4 +100,4 @@ let make = () => {
</Antd.Card> </Antd.Card>
<div className=Styles.spacer /> <div className=Styles.spacer />
</div>; </div>;
}; };

View File

@ -22,11 +22,11 @@ class BaseDistributionBinned {
*/ */
constructor(args) { constructor(args) {
this._set_props(); this._set_props();
this.max_bin_size = 0.5; this.max_bin_size = 0.005;
this.min_bin_size = 0; this.min_bin_size = 0;
this.increment = 0.001; this.increment = 0.0001;
this.desired_delta = 0.01; this.desired_delta = 0.0001;
this.start_bin_size = 0.01; this.start_bin_size = 0.0001;
[this.params, this.pdf_func, this.sample] = this.get_params_and_pdf_func( [this.params, this.pdf_func, this.sample] = this.get_params_and_pdf_func(
args args
@ -179,7 +179,7 @@ class LogNormalDistributionBinned extends BaseDistributionBinned {
_set_props() { _set_props() {
this.name = "lognormal"; this.name = "lognormal";
this.param_names = ["normal_mean", "normal_std"]; this.param_names = ["normal_mean", "normal_std"];
this.n_bounds_samples = 100; this.n_bounds_samples = 10000;
this.n_largest_bound_sample = 10; this.n_largest_bound_sample = 10;
} }
@ -242,4 +242,4 @@ const distrs = {
uniform: UniformDistributionBinned uniform: UniformDistributionBinned
}; };
exports.distrs = distrs; exports.distrs = distrs;

View File

@ -5,8 +5,8 @@ const distrs = require("./distribution.js").distrs;
const parse = require("./parse.js"); const parse = require("./parse.js");
const math = _math.create(_math.all); const math = _math.create(_math.all);
const NUM_MC_SAMPLES = 300; const NUM_MC_SAMPLES = 3000;
const OUTPUT_GRID_NUMEL = 300; const OUTPUT_GRID_NUMEL = 3000;
/** /**
* The main algorithmic work is done by functions in this module. * The main algorithmic work is done by functions in this module.