From 0e0f0221e91e4733f983114ba76e617eb687d623 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 21 Mar 2020 10:49:26 +0000 Subject: [PATCH] Dist-builder-2-adjustments --- src/components/DistBuilder2.re | 26 +++++++++++++++++++------- src/components/editor/distribution.js | 12 ++++++------ src/components/editor/main.js | 4 ++-- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/components/DistBuilder2.re b/src/components/DistBuilder2.re index 488f79ed..76fe6c0b 100644 --- a/src/components/DistBuilder2.re +++ b/src/components/DistBuilder2.re @@ -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); + ; + }; E.ste}>
- {isEmpty - ? "Nothing to show. Try to change the distribution description." - |> E.ste - : } + inside ; }; }; @@ -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 = () => {
; -}; +}; \ No newline at end of file diff --git a/src/components/editor/distribution.js b/src/components/editor/distribution.js index 31908bc6..4e212fa3 100644 --- a/src/components/editor/distribution.js +++ b/src/components/editor/distribution.js @@ -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; \ No newline at end of file diff --git a/src/components/editor/main.js b/src/components/editor/main.js index 7f93cb78..bc85200c 100644 --- a/src/components/editor/main.js +++ b/src/components/editor/main.js @@ -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.