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 (ys, xs, isEmpty) =
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}>
<div className=Styles.spacer />
{isEmpty
? "Nothing to show. Try to change the distribution description."
|> E.ste
: <DistributionPlot continuous />}
inside
</Antd.Card>;
};
};
@ -54,7 +66,7 @@ let make = () => {
~validationStrategy=OnDemand,
~schema,
~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>
<div className=Styles.spacer />
</div>;
};
};

View File

@ -22,11 +22,11 @@ class BaseDistributionBinned {
*/
constructor(args) {
this._set_props();
this.max_bin_size = 0.5;
this.max_bin_size = 0.005;
this.min_bin_size = 0;
this.increment = 0.001;
this.desired_delta = 0.01;
this.start_bin_size = 0.01;
this.increment = 0.0001;
this.desired_delta = 0.0001;
this.start_bin_size = 0.0001;
[this.params, this.pdf_func, this.sample] = this.get_params_and_pdf_func(
args
@ -179,7 +179,7 @@ class LogNormalDistributionBinned extends BaseDistributionBinned {
_set_props() {
this.name = "lognormal";
this.param_names = ["normal_mean", "normal_std"];
this.n_bounds_samples = 100;
this.n_bounds_samples = 10000;
this.n_largest_bound_sample = 10;
}
@ -242,4 +242,4 @@ const distrs = {
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 math = _math.create(_math.all);
const NUM_MC_SAMPLES = 300;
const OUTPUT_GRID_NUMEL = 300;
const NUM_MC_SAMPLES = 3000;
const OUTPUT_GRID_NUMEL = 3000;
/**
* The main algorithmic work is done by functions in this module.