From 5046a04c40bbe2bfa3c8eea6f0fd8617ad6d188f Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 11:29:06 +0000 Subject: [PATCH 01/28] First attempt at adding dist functionality --- package.json | 4 +- src/lib/Prop.re | 2 +- src/lib/Types.re | 4 + src/models/EAFunds.re | 4 +- src/utility/CdfLibrary.js | 160 ++++++++ src/utility/CdfLibrary.re | 56 +++ src/utility/GuesstimatorLibrary.js | 46 +++ src/utility/GuesstimatorLibrary3.re | 2 + yarn.lock | 600 +++++++++++++++++++++++++--- 9 files changed, 815 insertions(+), 63 deletions(-) create mode 100644 src/lib/Types.re create mode 100644 src/utility/CdfLibrary.js create mode 100644 src/utility/CdfLibrary.re create mode 100644 src/utility/GuesstimatorLibrary.js create mode 100644 src/utility/GuesstimatorLibrary3.re diff --git a/package.json b/package.json index 1ac59fb6..40eaad54 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "author": "", "license": "MIT", "dependencies": { + "@foretold/cdf": "^1.0.14", + "@foretold/guesstimator": "^1.0.10", "antd": "3.17.0", "autoprefixer": "^9.7.4", "bs-ant-design-alt": "2.0.0-alpha.31", @@ -46,4 +48,4 @@ "moduleserve": "^0.9.0", "tailwindcss": "^1.2.0" } -} \ No newline at end of file +} diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 46f6dd17..4d2caffa 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -120,7 +120,7 @@ module TypeWithMetadata = { let currentYear = make( ~id="currentYear", - ~name="Current Year", + ~name="Current Day", ~description=None, ~type_= DateTime({ diff --git a/src/lib/Types.re b/src/lib/Types.re new file mode 100644 index 00000000..8d571ade --- /dev/null +++ b/src/lib/Types.re @@ -0,0 +1,4 @@ +type distribution = { + xs: array(float), + ys: array(float), +}; \ No newline at end of file diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 75b44750..0d8814a3 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -166,8 +166,8 @@ module Interface = { let model: Prop.Model.t = Prop.{ - name: "EA Funds: Donations & Payouts", - description: "Calculate the payments and payouts of EA Funds based on existing data.", + name: "CEA Funds: Donations & Payouts", + description: "Calculate the payments and payouts of CEA Funds based on existing data.", version: "1.0.0", author: "Ozzie Gooen", inputTypes: [| diff --git a/src/utility/CdfLibrary.js b/src/utility/CdfLibrary.js new file mode 100644 index 00000000..528e2dda --- /dev/null +++ b/src/utility/CdfLibrary.js @@ -0,0 +1,160 @@ +const { + Cdf, + ContinuousDistribution, + ContinuousDistributionCombination, + scoringFunctions, + } = require("@foretold/cdf/lib"); + const _ = require("lodash"); + + /** + * + * @param xs + * @param ys + * @returns {{ys: *, xs: *}} + */ + function cdfToPdf({ xs, ys }) { + let cdf = new Cdf(xs, ys); + let pdf = cdf.toPdf(); + return { xs: pdf.xs, ys: pdf.ys }; + } + + /** + * + * @param xs + * @param ys + * @returns {{ys: *, xs: *}} + */ + function pdfToCdf({ xs, ys }) { + let cdf = new Pdf(xs, ys); + let pdf = cdf.toCdf(); + return { xs: pdf.xs, ys: pdf.ys }; + } + + /** + * + * @param sampleCount + * @param vars + * @returns {{ys: *, xs: *}} + */ + function mean(sampleCount, vars) { + let cdfs = vars.map(r => new Cdf(r.xs, r.ys)); + let comb = new ContinuousDistributionCombination(cdfs); + let newCdf = comb.combineYsWithMean(sampleCount); + + return { xs: newCdf.xs, ys: newCdf.ys }; + } + + /** + * + * @param sampleCount + * @param predictionCdf + * @param resolutionCdf + */ + function scoreNonMarketCdfCdf(sampleCount, predictionCdf, resolutionCdf, resolutionUniformAdditionWeight=0) { + let toCdf = (r) => (new Cdf(r.xs, r.ys)); + let prediction = toCdf(predictionCdf); + if (_.isFinite(resolutionUniformAdditionWeight)){ + prediction = prediction.combineWithUniformOfCdf( + { + cdf: toCdf(resolutionCdf), + uniformWeight: resolutionUniformAdditionWeight, + sampleCount + } + ); + } + + return scoringFunctions.distributionInputDistributionOutputMarketless({ + predictionCdf: prediction, + resultCdf: toCdf(resolutionCdf), + sampleCount, + }); + } + + /** + * + * @param sampleCount + * @param cdf + */ + function differentialEntropy(sampleCount, cdf) { + let toCdf = (r) => (new Cdf(r.xs, r.ys)); + + return scoringFunctions.differentialEntropy({ + cdf: toCdf(cdf), + sampleCount: sampleCount + }); + } + + /** + * + * @param x + * @param xs + * @param ys + * @returns {number} + */ + function findY(x, { xs, ys }) { + let cdf = new Cdf(xs, ys); + return cdf.findY(x); + } + + /** + * + * @param y + * @param xs + * @param ys + * @returns {number} + */ + function findX(y, { xs, ys }) { + let cdf = new Cdf(xs, ys); + return cdf.findX(y); + } + + /** + * + * @param xs + * @param ys + * @returns {number[]} + */ + function integral({ xs, ys }) { + if (_.includes(ys, NaN)){ + return NaN; + } + else if (_.includes(ys, Infinity) && _.includes(ys, -Infinity)){ + return NaN; + } + else if (_.includes(ys, Infinity)){ + return Infinity; + } + else if (_.includes(ys, -Infinity)){ + return -Infinity; + } + + let integral = 0; + for (let i = 1; i < ys.length; i++) { + let thisY = ys[i]; + let lastY = ys[i - 1]; + let thisX = xs[i]; + let lastX = xs[i - 1]; + + if ( + _.isFinite(thisY) && _.isFinite(lastY) && + _.isFinite(thisX) && _.isFinite(lastX) + ) { + let sectionInterval = ((thisY + lastY) / 2) * (thisX - lastX); + integral = integral + sectionInterval; + } + + } + return integral; + } + + module.exports = { + cdfToPdf, + pdfToCdf, + findY, + findX, + mean, + scoreNonMarketCdfCdf, + differentialEntropy, + integral, + }; + \ No newline at end of file diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re new file mode 100644 index 00000000..01d20a65 --- /dev/null +++ b/src/utility/CdfLibrary.re @@ -0,0 +1,56 @@ +module JS = { + [@bs.deriving abstract] + type distJs = { + xs: array(float), + ys: array(float), + }; + + let distToJs = (d: Types.distribution) => distJs(~xs=d.xs, ~ys=d.ys); + + let jsToDist = (d: distJs): Types.distribution => { + xs: xsGet(d), + ys: ysGet(d), + }; + + let doAsDist = (f, d: Types.distribution) => d |> distToJs |> f |> jsToDist; + + [@bs.module "./CdfLibraryImporter.js"] + external cdfToPdf: distJs => distJs = "cdfToPdf"; + + [@bs.module "./CdfLibraryImporter.js"] + external pdfToCdf: distJs => distJs = "pdfToCdf"; + + [@bs.module "./CdfLibraryImporter.js"] + external findY: (float, distJs) => float = "findY"; + + [@bs.module "./CdfLibraryImporter.js"] + external findX: (float, distJs) => float = "findX"; + + [@bs.module "./CdfLibraryImporter.js"] + external integral: distJs => float = "integral"; + + [@bs.module "./CdfLibraryImporter.js"] + external differentialEntropy: (int, distJs) => distJs = + "differentialEntropy"; + + [@bs.module "./CdfLibraryImporter.js"] + external scoreNonMarketCdfCdf: (int, distJs, distJs, float) => distJs = + "scoreNonMarketCdfCdf"; + + [@bs.module "./GuesstimatorLibrary.js"] + external toGuesstimator: (string, int) => distJs = "run"; +}; + +module Distribution = { + let toPdf = dist => dist |> JS.doAsDist(JS.cdfToPdf); + let toCdf = dist => dist |> JS.doAsDist(JS.cdfToPdf); + let findX = (y, dist) => dist |> JS.distToJs |> JS.findX(y); + let findY = (x, dist) => dist |> JS.distToJs |> JS.findY(x); + let fromString = (str: string, sampleCount: int) => + JS.toGuesstimator(str, sampleCount) |> JS.jsToDist; + let integral = dist => dist |> JS.distToJs |> JS.integral; + let differentialEntropy = (maxCalculationLength, dist) => + dist + |> JS.doAsDist(JS.differentialEntropy(maxCalculationLength)) + |> integral; +}; \ No newline at end of file diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js new file mode 100644 index 00000000..4109742e --- /dev/null +++ b/src/utility/GuesstimatorLibrary.js @@ -0,0 +1,46 @@ +import { Guesstimator } from '@foretold/guesstimator'; +import { Samples } from '@foretold/cdf'; + +const toPdf = (values, min, max) => { + const samples = new Samples(values); + + const ratioSize$ = ratioSize(samples); + const width = ratioSize$ === 'SMALL' ? 20 : 1; + + const pdf = samples.toPdf({ size: 1000, width, min, max }); + return {ys:pdf.ys, xs:pdf.xs}; +}; + +let run = (text, sampleCount, inputs=[], min=false, max=false) => { + let [_error, item] = Guesstimator.parse({ text }); + const { parsedInput } = item; + const { guesstimateType } = parsedInput; + + const guesstimator = new Guesstimator({ parsedInput }); + const value = guesstimator.sample( + sampleCount, + inputs, + ); + const samplerType = guesstimator.samplerType(); + + const values = _.filter(value.values, _.isFinite); + + this.setState({ + value: event.target.value, + items: values, + }); + + let update; + if (values.length === 0) { + update = {xs: [], ys: []}; + } else if (values.length === 1) { + update = {xs: [], ys: []}; + } else { + update = toPdf(values, min, max); + } + return update; +} + +module.exports = { + run, +}; \ No newline at end of file diff --git a/src/utility/GuesstimatorLibrary3.re b/src/utility/GuesstimatorLibrary3.re new file mode 100644 index 00000000..b5c62dda --- /dev/null +++ b/src/utility/GuesstimatorLibrary3.re @@ -0,0 +1,2 @@ +// [@bs.module "./GuesstimatorLibrary.js"] + /* external toGuesstimator: (string, int) => CdfLibrary.JS.distJs = "run"*/ \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 6d58693d..45389c93 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30,6 +30,13 @@ dependencies: "@babel/highlight" "^7.8.3" +"@babel/code-frame@^7.0.0 <7.4.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== + dependencies: + "@babel/highlight" "^7.0.0" + "@babel/compat-data@^7.8.4": version "7.8.5" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.5.tgz#d28ce872778c23551cbb9432fc68d28495b613b9" @@ -39,6 +46,26 @@ invariant "^2.2.4" semver "^5.5.0" +"@babel/core@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.3.4.tgz#921a5a13746c21e32445bf0798680e9d11a6530b" + integrity sha512-jRsuseXBo9pN197KnDwhhaaBzyZr2oIcLHHTt2oDdQrej5Qp57dCCJafWx5ivU8/alEYDpssYqv1MUqcxwQlrA== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.3.4" + "@babel/helpers" "^7.2.0" + "@babel/parser" "^7.3.4" + "@babel/template" "^7.2.2" + "@babel/traverse" "^7.3.4" + "@babel/types" "^7.3.4" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.11" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/core@^7.4.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" @@ -60,7 +87,18 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.4.4", "@babel/generator@^7.8.4": +"@babel/generator@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.4.tgz#9aa48c1989257877a9d971296e5b73bfe72e446e" + integrity sha512-8EXhHRFqlVVWXPezBW5keTiQi/rJMQTg/Y9uVCEZ0CAF3PKtCCaVRnp64Ii1ujhkoDhhF1fVsImoN4yJ2uz4Wg== + dependencies: + "@babel/types" "^7.3.4" + jsesc "^2.5.1" + lodash "^4.17.11" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/generator@^7.3.4", "@babel/generator@^7.4.4", "@babel/generator@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.4.tgz#35bbc74486956fe4251829f9f6c48330e8d0985e" integrity sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA== @@ -85,7 +123,7 @@ "@babel/helper-explode-assignable-expression" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-builder-react-jsx@^7.8.3": +"@babel/helper-builder-react-jsx@^7.3.0", "@babel/helper-builder-react-jsx@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.8.3.tgz#dee98d7d79cc1f003d80b76fe01c7f8945665ff6" integrity sha512-JT8mfnpTkKNCboTqZsQTdGo3l3Ik3l7QIt9hh0O9DYiwVel37VoJpILKM4YFbP2euF32nkQSb+F9cUk9b7DDXQ== @@ -138,7 +176,7 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-function-name@^7.8.3": +"@babel/helper-function-name@^7.1.0", "@babel/helper-function-name@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== @@ -168,14 +206,14 @@ dependencies: "@babel/types" "^7.8.3" -"@babel/helper-module-imports@^7.8.3": +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg== dependencies: "@babel/types" "^7.8.3" -"@babel/helper-module-transforms@^7.8.3": +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.8.3.tgz#d305e35d02bee720fbc2c3c3623aa0c316c01590" integrity sha512-C7NG6B7vfBa/pwCOshpMbOYUmrYQDfCpVL/JCRu0ek8B5p8kue1+BCXpg2vOYs7w5ACB9GTOBYQ5U6NwrMg+3Q== @@ -194,7 +232,7 @@ dependencies: "@babel/types" "^7.8.3" -"@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670" integrity sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ== @@ -227,7 +265,7 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-simple-access@^7.8.3": +"@babel/helper-simple-access@^7.1.0", "@babel/helper-simple-access@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" integrity sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw== @@ -235,7 +273,7 @@ "@babel/template" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-split-export-declaration@^7.8.3": +"@babel/helper-split-export-declaration@^7.0.0", "@babel/helper-split-export-declaration@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== @@ -252,7 +290,7 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helpers@^7.8.4": +"@babel/helpers@^7.2.0", "@babel/helpers@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.8.4.tgz#754eb3ee727c165e0a240d6c207de7c455f36f73" integrity sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w== @@ -261,7 +299,7 @@ "@babel/traverse" "^7.8.4" "@babel/types" "^7.8.3" -"@babel/highlight@^7.8.3": +"@babel/highlight@^7.0.0", "@babel/highlight@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== @@ -270,12 +308,17 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.4.4", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": +"@babel/parser@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.4.tgz#a43357e4bbf4b92a437fb9e465c192848287f27c" + integrity sha512-tXZCqWtlOOP4wgCp6RjRvLmfuhnqTLy9VHwRochJBCP2nDm27JnnuFEnXFASVyQNHk36jD1tAammsCEEqgscIQ== + +"@babel/parser@^7.2.2", "@babel/parser@^7.3.4", "@babel/parser@^7.4.4", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== -"@babel/plugin-proposal-async-generator-functions@^7.8.3": +"@babel/plugin-proposal-async-generator-functions@^7.2.0", "@babel/plugin-proposal-async-generator-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" integrity sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw== @@ -292,7 +335,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/plugin-proposal-json-strings@^7.8.3": +"@babel/plugin-proposal-json-strings@^7.2.0", "@babel/plugin-proposal-json-strings@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.8.3.tgz#da5216b238a98b58a1e05d6852104b10f9a70d6b" integrity sha512-KGhQNZ3TVCQG/MjRbAUwuH+14y9q0tpxs1nWWs3pbSleRdDro9SAMMDyye8HhY1gqZ7/NqIc8SKhya0wRDgP1Q== @@ -308,7 +351,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" -"@babel/plugin-proposal-object-rest-spread@^7.8.3": +"@babel/plugin-proposal-object-rest-spread@^7.3.4", "@babel/plugin-proposal-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb" integrity sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA== @@ -316,7 +359,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" -"@babel/plugin-proposal-optional-catch-binding@^7.8.3": +"@babel/plugin-proposal-optional-catch-binding@^7.2.0", "@babel/plugin-proposal-optional-catch-binding@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.8.3.tgz#9dee96ab1650eed88646ae9734ca167ac4a9c5c9" integrity sha512-0gkX7J7E+AtAw9fcwlVQj8peP61qhdg/89D5swOkjYbkboA2CVckn3kiyum1DE0wskGb7KJJxBdyEBApDLLVdw== @@ -332,7 +375,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.0" -"@babel/plugin-proposal-unicode-property-regex@^7.8.3": +"@babel/plugin-proposal-unicode-property-regex@^7.2.0", "@babel/plugin-proposal-unicode-property-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.8.3.tgz#b646c3adea5f98800c9ab45105ac34d06cd4a47f" integrity sha512-1/1/rEZv2XGweRwwSkLpY+s60za9OZ1hJs4YDqFHCw0kYWYwL5IFljVY1MYBL+weT1l9pokDO2uhSTLVxzoHkQ== @@ -340,7 +383,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-async-generators@^7.8.0": +"@babel/plugin-syntax-async-generators@^7.2.0", "@babel/plugin-syntax-async-generators@^7.8.0": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== @@ -354,21 +397,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-flow@^7.8.3": +"@babel/plugin-syntax-flow@^7.2.0", "@babel/plugin-syntax-flow@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz#f2c883bd61a6316f2c89380ae5122f923ba4527f" integrity sha512-innAx3bUbA0KSYj2E2MNFSn9hiCeowOFLxlsuhXzw8hMQnzkDomUr9QCD7E9VF60NmnG1sNTuuv6Qf4f8INYsg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-json-strings@^7.8.0": +"@babel/plugin-syntax-json-strings@^7.2.0", "@babel/plugin-syntax-json-strings@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.8.3": +"@babel/plugin-syntax-jsx@^7.2.0", "@babel/plugin-syntax-jsx@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.8.3.tgz#521b06c83c40480f1e58b4fd33b92eceb1d6ea94" integrity sha512-WxdW9xyLgBdefoo0Ynn3MRSkhe5tFVxxKNVdnZSh318WrG2e2jH+E9wd/++JsqcLJZPfz87njQJ8j2Upjm0M0A== @@ -382,14 +425,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-object-rest-spread@^7.8.0": +"@babel/plugin-syntax-object-rest-spread@^7.2.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-catch-binding@^7.8.0": +"@babel/plugin-syntax-optional-catch-binding@^7.2.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== @@ -410,14 +453,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-arrow-functions@^7.8.3": +"@babel/plugin-transform-arrow-functions@^7.2.0", "@babel/plugin-transform-arrow-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz#82776c2ed0cd9e1a49956daeb896024c9473b8b6" integrity sha512-0MRF+KC8EqH4dbuITCWwPSzsyO3HIWWlm30v8BbbpOrS1B++isGxPnnuq/IZvOX5J2D/p7DQalQm+/2PnlKGxg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-async-to-generator@^7.8.3": +"@babel/plugin-transform-async-to-generator@^7.3.4", "@babel/plugin-transform-async-to-generator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz#4308fad0d9409d71eafb9b1a6ee35f9d64b64086" integrity sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ== @@ -426,14 +469,14 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-remap-async-to-generator" "^7.8.3" -"@babel/plugin-transform-block-scoped-functions@^7.8.3": +"@babel/plugin-transform-block-scoped-functions@^7.2.0", "@babel/plugin-transform-block-scoped-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz#437eec5b799b5852072084b3ae5ef66e8349e8a3" integrity sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-block-scoping@^7.8.3": +"@babel/plugin-transform-block-scoping@^7.3.4", "@babel/plugin-transform-block-scoping@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz#97d35dab66857a437c166358b91d09050c868f3a" integrity sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w== @@ -441,7 +484,7 @@ "@babel/helper-plugin-utils" "^7.8.3" lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.8.3": +"@babel/plugin-transform-classes@^7.3.4", "@babel/plugin-transform-classes@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.3.tgz#46fd7a9d2bb9ea89ce88720477979fe0d71b21b8" integrity sha512-SjT0cwFJ+7Rbr1vQsvphAHwUHvSUPmMjMU/0P59G8U2HLFqSa082JO7zkbDNWs9kH/IUqpHI6xWNesGf8haF1w== @@ -455,21 +498,21 @@ "@babel/helper-split-export-declaration" "^7.8.3" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.8.3": +"@babel/plugin-transform-computed-properties@^7.2.0", "@babel/plugin-transform-computed-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.8.3.tgz#96d0d28b7f7ce4eb5b120bb2e0e943343c86f81b" integrity sha512-O5hiIpSyOGdrQZRQ2ccwtTVkgUDBBiCuK//4RJ6UfePllUTCENOzKxfh6ulckXKc0DixTFLCfb2HVkNA7aDpzA== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-destructuring@^7.8.3": +"@babel/plugin-transform-destructuring@^7.2.0", "@babel/plugin-transform-destructuring@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.3.tgz#20ddfbd9e4676906b1056ee60af88590cc7aaa0b" integrity sha512-H4X646nCkiEcHZUZaRkhE2XVsoz0J/1x3VVujnn96pSoGCtKPA99ZZA+va+gK+92Zycd6OBKCD8tDb/731bhgQ== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-dotall-regex@^7.8.3": +"@babel/plugin-transform-dotall-regex@^7.2.0", "@babel/plugin-transform-dotall-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.8.3.tgz#c3c6ec5ee6125c6993c5cbca20dc8621a9ea7a6e" integrity sha512-kLs1j9Nn4MQoBYdRXH6AeaXMbEJFaFu/v1nQkvib6QzTj8MZI5OQzqmD83/2jEM1z0DLilra5aWO5YpyC0ALIw== @@ -477,14 +520,14 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-duplicate-keys@^7.8.3": +"@babel/plugin-transform-duplicate-keys@^7.2.0", "@babel/plugin-transform-duplicate-keys@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.8.3.tgz#8d12df309aa537f272899c565ea1768e286e21f1" integrity sha512-s8dHiBUbcbSgipS4SMFuWGqCvyge5V2ZeAWzR6INTVC3Ltjig/Vw1G2Gztv0vU/hRG9X8IvKvYdoksnUfgXOEQ== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-exponentiation-operator@^7.8.3": +"@babel/plugin-transform-exponentiation-operator@^7.2.0", "@babel/plugin-transform-exponentiation-operator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.8.3.tgz#581a6d7f56970e06bf51560cd64f5e947b70d7b7" integrity sha512-zwIpuIymb3ACcInbksHaNcR12S++0MDLKkiqXHl3AzpgdKlFNhog+z/K0+TGW+b0w5pgTq4H6IwV/WhxbGYSjQ== @@ -492,6 +535,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" +"@babel/plugin-transform-flow-strip-types@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.3.4.tgz#00156236defb7dedddc2d3c9477dcc01a4494327" + integrity sha512-PmQC9R7DwpBFA+7ATKMyzViz3zCaMNouzZMPZN2K5PnbBbtL3AXFYTkDk+Hey5crQq2A90UG5Uthz0mel+XZrA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.2.0" + "@babel/plugin-transform-flow-strip-types@^7.4.4": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.8.3.tgz#da705a655466b2a9b36046b57bf0cbcd53551bd4" @@ -500,14 +551,14 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-flow" "^7.8.3" -"@babel/plugin-transform-for-of@^7.8.4": +"@babel/plugin-transform-for-of@^7.2.0", "@babel/plugin-transform-for-of@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.4.tgz#6fe8eae5d6875086ee185dd0b098a8513783b47d" integrity sha512-iAXNlOWvcYUYoV8YIxwS7TxGRJcxyl8eQCfT+A5j8sKUzRFvJdcyjp97jL2IghWSRDaL2PU2O2tX8Cu9dTBq5A== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-function-name@^7.8.3": +"@babel/plugin-transform-function-name@^7.2.0", "@babel/plugin-transform-function-name@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz#279373cb27322aaad67c2683e776dfc47196ed8b" integrity sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ== @@ -515,7 +566,7 @@ "@babel/helper-function-name" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-literals@^7.8.3": +"@babel/plugin-transform-literals@^7.2.0", "@babel/plugin-transform-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz#aef239823d91994ec7b68e55193525d76dbd5dc1" integrity sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A== @@ -529,7 +580,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-amd@^7.8.3": +"@babel/plugin-transform-modules-amd@^7.2.0", "@babel/plugin-transform-modules-amd@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.8.3.tgz#65606d44616b50225e76f5578f33c568a0b876a5" integrity sha512-MadJiU3rLKclzT5kBH4yxdry96odTUwuqrZM+GllFI/VhxfPz+k9MshJM+MwhfkCdxxclSbSBbUGciBngR+kEQ== @@ -538,7 +589,16 @@ "@babel/helper-plugin-utils" "^7.8.3" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.4.4", "@babel/plugin-transform-modules-commonjs@^7.8.3": +"@babel/plugin-transform-modules-commonjs@^7.0.0 <7.4.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.2.0.tgz#c4f1933f5991d5145e9cfad1dfd848ea1727f404" + integrity sha512-V6y0uaUQrQPXUrmj+hgnks8va2L0zcZymeU7TtWEgdRLNkceafKXEduv7QzgQAE4lT+suwooG9dC7LFhdRAbVQ== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + +"@babel/plugin-transform-modules-commonjs@^7.2.0", "@babel/plugin-transform-modules-commonjs@^7.4.4", "@babel/plugin-transform-modules-commonjs@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.8.3.tgz#df251706ec331bd058a34bdd72613915f82928a5" integrity sha512-JpdMEfA15HZ/1gNuB9XEDlZM1h/gF/YOH7zaZzQu2xCFRfwc01NXBMHHSTT6hRjlXJJs5x/bfODM3LiCk94Sxg== @@ -548,7 +608,7 @@ "@babel/helper-simple-access" "^7.8.3" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-systemjs@^7.8.3": +"@babel/plugin-transform-modules-systemjs@^7.3.4", "@babel/plugin-transform-modules-systemjs@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.8.3.tgz#d8bbf222c1dbe3661f440f2f00c16e9bb7d0d420" integrity sha512-8cESMCJjmArMYqa9AO5YuMEkE4ds28tMpZcGZB/jl3n0ZzlsxOAi3mC+SKypTfT8gjMupCnd3YiXCkMjj2jfOg== @@ -558,7 +618,7 @@ "@babel/helper-plugin-utils" "^7.8.3" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-umd@^7.8.3": +"@babel/plugin-transform-modules-umd@^7.2.0", "@babel/plugin-transform-modules-umd@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.8.3.tgz#592d578ce06c52f5b98b02f913d653ffe972661a" integrity sha512-evhTyWhbwbI3/U6dZAnx/ePoV7H6OUG+OjiJFHmhr9FPn0VShjwC2kdxqIuQ/+1P50TMrneGzMeyMTFOjKSnAw== @@ -566,21 +626,21 @@ "@babel/helper-module-transforms" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": +"@babel/plugin-transform-named-capturing-groups-regex@^7.3.0", "@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz#a2a72bffa202ac0e2d0506afd0939c5ecbc48c6c" integrity sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw== dependencies: "@babel/helper-create-regexp-features-plugin" "^7.8.3" -"@babel/plugin-transform-new-target@^7.8.3": +"@babel/plugin-transform-new-target@^7.0.0", "@babel/plugin-transform-new-target@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz#60cc2ae66d85c95ab540eb34babb6434d4c70c43" integrity sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-object-super@^7.8.3": +"@babel/plugin-transform-object-super@^7.2.0", "@babel/plugin-transform-object-super@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz#ebb6a1e7a86ffa96858bd6ac0102d65944261725" integrity sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ== @@ -588,7 +648,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-replace-supers" "^7.8.3" -"@babel/plugin-transform-parameters@^7.8.4": +"@babel/plugin-transform-parameters@^7.2.0", "@babel/plugin-transform-parameters@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.4.tgz#1d5155de0b65db0ccf9971165745d3bb990d77d3" integrity sha512-IsS3oTxeTsZlE5KqzTbcC2sV0P9pXdec53SU+Yxv7o/6dvGM5AkTotQKhoSffhNgZ/dftsSiOoxy7evCYJXzVA== @@ -613,7 +673,16 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-jsx" "^7.8.3" -"@babel/plugin-transform-regenerator@^7.8.3": +"@babel/plugin-transform-react-jsx@^7.0.0 <7.4.0": + version "7.3.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz#f2cab99026631c767e2745a5368b331cfe8f5290" + integrity sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg== + dependencies: + "@babel/helper-builder-react-jsx" "^7.3.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@babel/plugin-transform-regenerator@^7.3.4", "@babel/plugin-transform-regenerator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.3.tgz#b31031e8059c07495bf23614c97f3d9698bc6ec8" integrity sha512-qt/kcur/FxrQrzFR432FGZznkVAjiyFtCOANjkAKwCbt465L6ZCiUQh2oMYGU3Wo8LRFJxNDFwWn106S5wVUNA== @@ -627,21 +696,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-shorthand-properties@^7.8.3": +"@babel/plugin-transform-shorthand-properties@^7.2.0", "@babel/plugin-transform-shorthand-properties@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" integrity sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-spread@^7.8.3": +"@babel/plugin-transform-spread@^7.2.0", "@babel/plugin-transform-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.8.3.tgz#9c8ffe8170fdfb88b114ecb920b82fb6e95fe5e8" integrity sha512-CkuTU9mbmAoFOI1tklFWYYbzX5qCIZVXPVy0jpXgGwkplCndQAa58s2jr66fTeQnA64bDox0HL4U56CFYoyC7g== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-sticky-regex@^7.8.3": +"@babel/plugin-transform-sticky-regex@^7.2.0", "@babel/plugin-transform-sticky-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz#be7a1290f81dae767475452199e1f76d6175b100" integrity sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw== @@ -649,7 +718,7 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-regex" "^7.8.3" -"@babel/plugin-transform-template-literals@^7.8.3": +"@babel/plugin-transform-template-literals@^7.2.0", "@babel/plugin-transform-template-literals@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.8.3.tgz#7bfa4732b455ea6a43130adc0ba767ec0e402a80" integrity sha512-820QBtykIQOLFT8NZOcTRJ1UNuztIELe4p9DCgvj4NK+PwluSJ49we7s9FB1HIGNIYT7wFUJ0ar2QpCDj0escQ== @@ -657,14 +726,14 @@ "@babel/helper-annotate-as-pure" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-typeof-symbol@^7.8.4": +"@babel/plugin-transform-typeof-symbol@^7.2.0", "@babel/plugin-transform-typeof-symbol@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.8.4.tgz#ede4062315ce0aaf8a657a920858f1a2f35fc412" integrity sha512-2QKyfjGdvuNfHsb7qnBBlKclbD4CfshH2KvDabiijLMGXPHJXGxtDzwIF7bQP+T0ysw8fYTtxPafgfs/c1Lrqg== dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-unicode-regex@^7.8.3": +"@babel/plugin-transform-unicode-regex@^7.2.0", "@babel/plugin-transform-unicode-regex@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz#0cef36e3ba73e5c57273effb182f46b91a1ecaad" integrity sha512-+ufgJjYdmWfSQ+6NS9VGUR2ns8cjJjYbrbi11mZBTaWm+Fui/ncTLFF28Ei1okavY+xkojGr1eJxNsWYeA5aZw== @@ -672,6 +741,55 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" +"@babel/preset-env@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.4.tgz#887cf38b6d23c82f19b5135298bdb160062e33e1" + integrity sha512-2mwqfYMK8weA0g0uBKOt4FE3iEodiHy9/CW0b+nWXcbL+pGzLx8ESYc+j9IIxr6LTDHWKgPm71i9smo02bw+gA== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.3.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.2.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.3.4" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.3.4" + "@babel/plugin-transform-classes" "^7.3.4" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.2.0" + "@babel/plugin-transform-dotall-regex" "^7.2.0" + "@babel/plugin-transform-duplicate-keys" "^7.2.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.2.0" + "@babel/plugin-transform-function-name" "^7.2.0" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.2.0" + "@babel/plugin-transform-modules-commonjs" "^7.2.0" + "@babel/plugin-transform-modules-systemjs" "^7.3.4" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.3.0" + "@babel/plugin-transform-new-target" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.2.0" + "@babel/plugin-transform-parameters" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.3.4" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.2.0" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.2.0" + browserslist "^4.3.4" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.3.0" + "@babel/preset-env@^7.4.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.8.4.tgz#9dac6df5f423015d3d49b6e9e5fa3413e4a72c4e" @@ -735,6 +853,13 @@ levenary "^1.1.1" semver "^5.5.0" +"@babel/runtime@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.4.tgz#73d12ba819e365fcf7fd152aed56d6df97d21c83" + integrity sha512-IvfvnMdSaLBateu0jfsYIpZTxAc2cKEXEMiezGGN75QcBcecDUKd3PgLAncT0oOgxKy8dd8hrJKj9MfzgfZd6g== + dependencies: + regenerator-runtime "^0.12.0" + "@babel/runtime@^7.4.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.4.tgz#d79f5a2040f7caa24d53e563aad49cbc05581308" @@ -742,7 +867,16 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.4.4", "@babel/template@^7.8.3": +"@babel/template@^7.0.0 <7.4.0": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" + integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.2.2" + "@babel/types" "^7.2.2" + +"@babel/template@^7.2.2", "@babel/template@^7.4.4", "@babel/template@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" integrity sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ== @@ -751,7 +885,22 @@ "@babel/parser" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/traverse@^7.4.4", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4": +"@babel/traverse@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.3.4.tgz#1330aab72234f8dea091b08c4f8b9d05c7119e06" + integrity sha512-TvTHKp6471OYEcE/91uWmhR6PrrYywQntCHSaZ8CM8Vmp+pjAusal4nGB2WCCQd0rvI7nOMKn9GnbcvTUz3/ZQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.3.4" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/parser" "^7.3.4" + "@babel/types" "^7.3.4" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.11" + +"@babel/traverse@^7.3.4", "@babel/traverse@^7.4.4", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.4.tgz#f0845822365f9d5b0e312ed3959d3f827f869e3c" integrity sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg== @@ -766,7 +915,16 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.4.4", "@babel/types@^7.8.3": +"@babel/types@^7.0.0 <7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.3.4.tgz#bf482eaeaffb367a28abbf9357a94963235d90ed" + integrity sha512-WEkp8MsLftM7O/ty580wAmZzN1nDmCACc5+jFzUt+GUFNNIi3LdRlueYz0YIlmJhlZx1QYDMZL5vdWCL0fNjFQ== + dependencies: + esutils "^2.0.2" + lodash "^4.17.11" + to-fast-properties "^2.0.0" + +"@babel/types@^7.2.2", "@babel/types@^7.3.4", "@babel/types@^7.4.4", "@babel/types@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.3.tgz#5a383dffa5416db1b73dedffd311ffd0788fb31c" integrity sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg== @@ -775,6 +933,27 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@foretold/cdf@^1.0.14": + version "1.0.14" + resolved "https://registry.yarnpkg.com/@foretold/cdf/-/cdf-1.0.14.tgz#a6b77a1fa211e3b5b8b3f75fbe1979499287eb89" + integrity sha512-Dfo9g2lJbNmJNL8dYnUjmrnOlTQXWJaadys0iuSxO2UNF0Y60RdRIllESviy/Qx2Pbzrkds5E7M4DncpMNPu8Q== + dependencies: + lodash "4.17.15" + parcel "1.12.3" + pdfast "0.2.0" + +"@foretold/guesstimator@^1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@foretold/guesstimator/-/guesstimator-1.0.10.tgz#8b3bf5371c836de6db31832a88a2c1f0eb4d3111" + integrity sha512-0mD9QcKUMjK5c4IxK7oZ7sGx1eMeAUAdeTiAOpecMI3qMvoYsuMF5aRDZQcWPEoKuW0grnxyLMHEv5N/vAX3kQ== + dependencies: + discrete-sampling "1.0.3" + financejs "4.1.0" + jstat "1.9.0" + lodash "4.17.15" + mathjs "5.10.3" + parcel "1.12.3" + "@iarna/toml@^2.2.0": version "2.2.3" resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.3.tgz#f060bf6eaafae4d56a7dac618980838b0696e2ab" @@ -823,7 +1002,7 @@ mkdirp "^0.5.1" rimraf "^2.6.2" -"@parcel/logger@^1.11.1": +"@parcel/logger@^1.11.0", "@parcel/logger@^1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@parcel/logger/-/logger-1.11.1.tgz#c55b0744bcbe84ebc291155627f0ec406a23e2e6" integrity sha512-9NF3M6UVeP2udOBDILuoEHd8VrF4vQqoWHEafymO1pfSoOMfxrSJZw1MfyAAIUN/IFp9qjcpDCUbDZB+ioVevA== @@ -839,7 +1018,7 @@ resolved "https://registry.yarnpkg.com/@parcel/utils/-/utils-1.11.0.tgz#539e08fff8af3b26eca11302be80b522674b51ea" integrity sha512-cA3p4jTlaMeOtAKR/6AadanOPvKeg8VwgnHhOyfi0yClD0TZS/hi9xu12w4EzA/8NtHu0g6o4RDfcNjqN8l1AQ== -"@parcel/watcher@^1.12.1": +"@parcel/watcher@^1.12.0", "@parcel/watcher@^1.12.1": version "1.12.1" resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-1.12.1.tgz#b98b3df309fcab93451b5583fc38e40826696dad" integrity sha512-od+uCtCxC/KoNQAIE1vWx1YTyKYY+7CTrxBJPRh3cDWw/C0tCtlBMVlrbplscGoEpt6B27KhJDCv82PBxOERNA== @@ -922,6 +1101,11 @@ abab@^2.0.0: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== + acorn-globals@^4.3.0: version "4.3.4" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" @@ -1202,6 +1386,11 @@ assert@^1.1.1: object-assign "^4.1.1" util "0.10.3" +assertion-error@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" @@ -1463,7 +1652,7 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.8.3, browserslist@^4.8.5: +browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.3.4, browserslist@^4.8.3, browserslist@^4.8.5: version "4.8.6" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.6.tgz#96406f3f5f0755d272e27a66f4163ca821590a7e" integrity sha512-ZHao85gf0eZ0ESxLfCp73GG9O/VTytYDIkIiZDlURppLTI9wErSM/5yAKEq6rcUdxBLjMELmrYUJGg5sxGKMHg== @@ -1613,6 +1802,15 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +chai@^3.0.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" + integrity sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc= + dependencies: + assertion-error "^1.0.1" + deep-eql "^0.1.3" + type-detect "^1.0.0" + chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1738,6 +1936,11 @@ clone@^2.1.1, clone@^2.1.2: resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= +clones@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/clones/-/clones-1.2.0.tgz#b34c872045446a9f264ccceb7731bca05c529b71" + integrity sha512-FXDYw4TjR8wgPZYui2LeTqWh1BLpfQ8lB6upMtlpDF6WlOOxghmTTxWyngdKTgozqBgKnHbTVwTE+hOHqAykuQ== + coa@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/coa/-/coa-2.0.2.tgz#43f6c21151b4ef2bf57187db0d73de229e3e7ec3" @@ -1812,6 +2015,11 @@ commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +complex.js@2.0.11: + version "2.0.11" + resolved "https://registry.yarnpkg.com/complex.js/-/complex.js-2.0.11.tgz#09a873fbf15ffd8c18c9c2201ccef425c32b8bf1" + integrity sha512-6IArJLApNtdg1P1dFtn3dnyzoZBEF0MwMnrfF1exSBRpZYoy4yieMkpZhQDC0uwctw48vii0CFVyHfpgZ/DfGw== + component-classes@1.x, component-classes@^1.2.5, component-classes@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/component-classes/-/component-classes-1.2.6.tgz#c642394c3618a4d8b0b8919efccbbd930e5cd691" @@ -1844,6 +2052,14 @@ concat-stream@~1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" +config-chain@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" + integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -1854,7 +2070,7 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= -convert-source-map@^1.5.1, convert-source-map@^1.7.0: +convert-source-map@^1.1.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -2199,11 +2415,23 @@ decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decimal.js@10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.0.tgz#39466113a9e036111d02f82489b5fd6b0b5ed231" + integrity sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw== + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +deep-eql@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" + integrity sha1-71WKyrjeJSBs1xOQbXTlaTDrafI= + dependencies: + type-detect "0.1.1" + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2303,6 +2531,13 @@ dir-glob@^3.0.1: dependencies: path-type "^4.0.0" +discrete-sampling@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/discrete-sampling/-/discrete-sampling-1.0.3.tgz#43311aa36782647006ae5bf87d8dad0a470b5d15" + integrity sha1-QzEao2eCZHAGrlv4fY2tCkcLXRU= + dependencies: + chai "^3.0.0" + dom-align@^1.7.0: version "1.10.4" resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.10.4.tgz#862ae4de0d11d6495c1c8ee1b195427e7caa727d" @@ -2377,6 +2612,11 @@ dot-prop@^4.1.1: dependencies: is-obj "^1.0.0" +dotenv-expand@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275" + integrity sha1-3vHxyl1gWdJKdm5YeULCEQbOEnU= + dotenv-expand@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" @@ -2411,6 +2651,16 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +editorconfig@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5" + integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g== + dependencies: + commander "^2.19.0" + lru-cache "^4.1.5" + semver "^5.6.0" + sigmund "^1.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -2526,6 +2776,11 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-latex@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/escape-latex/-/escape-latex-1.2.0.tgz#07c03818cf7dac250cce517f4fda1b001ef2bca1" + integrity sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2777,6 +3032,11 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +financejs@4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/financejs/-/financejs-4.1.0.tgz#e69b7cf4f0b5dd0c8a3b041992439513a2b93c41" + integrity sha1-5pt89PC13QyKOwQZkkOVE6K5PEE= + find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -2816,6 +3076,11 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" +fraction.js@4.0.12: + version "4.0.12" + resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.0.12.tgz#0526d47c65a5fb4854df78bc77f7bec708d7b8c3" + integrity sha512-8Z1K0VTG4hzYY7kA/1sj4/r1/RWLBD3xwReT/RCrUCbzPszjNQCCsy3ktkU/eaEqX3MYa4pY37a52eiBlPMlhA== + fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" @@ -3282,6 +3547,11 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= +ini@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -3569,6 +3839,27 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= +javascript-natural-sort@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" + integrity sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k= + +js-beautify@^1.8.9: + version "1.10.3" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.3.tgz#c73fa10cf69d3dfa52d8ed624f23c64c0a6a94c1" + integrity sha512-wfk/IAWobz1TfApSdivH5PJ0miIHgDoYb1ugSqHcODPmaYu46rYe5FVuIEkhjg8IQiv6rDNPyhsqbsohI/C2vQ== + dependencies: + config-chain "^1.1.12" + editorconfig "^0.15.3" + glob "^7.1.3" + mkdirp "~0.5.1" + nopt "~4.0.1" + +js-levenshtein@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3687,6 +3978,11 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jstat@1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/jstat/-/jstat-1.9.0.tgz#96a625f5697566f6ba3b15832fb371f9451b8614" + integrity sha512-xSsSJ3qY4rS+u8+dAwRcJ0LQGxNdibdW6rSalNPZDbLYkW1C7b0/j79IxXtQjrweqMNI3asN7FCIPceNSIJr2g== + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -3802,7 +4098,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.16.5, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5: +lodash@4.17.15, lodash@^4.16.5, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.17.5: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -3821,6 +4117,14 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4 dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + magic-string@^0.22.4: version "0.22.5" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" @@ -3840,6 +4144,20 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +mathjs@5.10.3: + version "5.10.3" + resolved "https://registry.yarnpkg.com/mathjs/-/mathjs-5.10.3.tgz#e998885f932ea8886db8b40f7f5b199f89b427f1" + integrity sha512-ySjg30BC3dYjQm73ILZtwcWzFJde0VU6otkXW/57IjjuYRa3Qaf0Kb8pydEuBZYtqW2OxreAtsricrAmOj3jIw== + dependencies: + complex.js "2.0.11" + decimal.js "10.2.0" + escape-latex "1.2.0" + fraction.js "4.0.12" + javascript-natural-sort "0.7.1" + seed-random "2.2.0" + tiny-emitter "2.1.0" + typed-function "1.1.0" + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -4096,6 +4414,14 @@ node-releases@^1.1.47: dependencies: semver "^6.3.0" +nopt@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= + dependencies: + abbrev "1" + osenv "^0.1.4" + normalize-html-whitespace@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/normalize-html-whitespace/-/normalize-html-whitespace-1.0.0.tgz#5e3c8e192f1b06c3b9eee4b7e7f28854c7601e34" @@ -4295,6 +4621,24 @@ os-browserify@^0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +os-tmpdir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +osenv@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + p-limit@^2.0.0, p-limit@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e" @@ -4403,6 +4747,69 @@ parcel-plugin-less-js-enabled@^1.0.2: dependencies: parcel-bundler "^1.12.3" +parcel@1.12.3: + version "1.12.3" + resolved "https://registry.yarnpkg.com/parcel/-/parcel-1.12.3.tgz#1f1341589380f20be924f1dd67c7fed193b346ec" + integrity sha512-j9XCVLeol9qZvGemRKt2z8bptbXq9LVy8/IzjqWQKMiKd8DR0NpDAlRHV0zyF72/J/UUTsdsrhnw6UGo9nGI+Q== + dependencies: + "@babel/code-frame" "^7.0.0 <7.4.0" + "@babel/core" "^7.0.0 <7.4.0" + "@babel/generator" "^7.0.0 <7.4.0" + "@babel/parser" "^7.0.0 <7.4.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0 <7.4.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0 <7.4.0" + "@babel/plugin-transform-react-jsx" "^7.0.0 <7.4.0" + "@babel/preset-env" "^7.0.0 <7.4.0" + "@babel/runtime" "^7.0.0 <7.4.0" + "@babel/template" "^7.0.0 <7.4.0" + "@babel/traverse" "^7.0.0 <7.4.0" + "@babel/types" "^7.0.0 <7.4.0" + "@iarna/toml" "^2.2.0" + "@parcel/fs" "^1.11.0" + "@parcel/logger" "^1.11.0" + "@parcel/utils" "^1.11.0" + "@parcel/watcher" "^1.12.0" + "@parcel/workers" "^1.11.0" + ansi-to-html "^0.6.4" + babylon-walk "^1.0.2" + browserslist "^4.1.0" + chalk "^2.1.0" + clone "^2.1.1" + command-exists "^1.2.6" + commander "^2.11.0" + cross-spawn "^6.0.4" + css-modules-loader-core "^1.1.0" + cssnano "^4.0.0" + deasync "^0.1.14" + dotenv "^5.0.0" + dotenv-expand "^4.2.0" + fast-glob "^2.2.2" + filesize "^3.6.0" + get-port "^3.2.0" + htmlnano "^0.2.2" + is-glob "^4.0.0" + is-url "^1.2.2" + js-yaml "^3.10.0" + json5 "^1.0.1" + micromatch "^3.0.4" + mkdirp "^0.5.1" + node-forge "^0.7.1" + node-libs-browser "^2.0.0" + opn "^5.1.0" + postcss "^7.0.11" + postcss-value-parser "^3.3.1" + posthtml "^0.11.2" + posthtml-parser "^0.4.0" + posthtml-render "^1.1.3" + resolve "^1.4.0" + semver "^5.4.1" + serialize-to-js "^1.1.1" + serve-static "^1.12.4" + source-map "0.6.1" + terser "^3.7.3" + v8-compile-cache "^2.0.0" + ws "^5.1.1" + parse-asn1@^5.0.0: version "5.1.5" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" @@ -4489,6 +4896,11 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +pdfast@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/pdfast/-/pdfast-0.2.0.tgz#8cbc556e1bf2522177787c0de2e0d4373ba885c9" + integrity sha1-jLxVbhvyUiF3eHwN4uDUNzuohck= + performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -5010,11 +5422,21 @@ prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.4, pr object-assign "^4.1.1" react-is "^16.8.1" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + psl@^1.1.24, psl@^1.1.28: version "1.7.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.7.0.tgz#f1c4c47a8ef97167dea5d6bbf4816d736e884a3c" @@ -5693,6 +6115,11 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== +regenerator-runtime@^0.12.0: + version "0.12.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" + integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== + regenerator-runtime@^0.13.2: version "0.13.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" @@ -5930,6 +6357,13 @@ safe-regex@^1.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +safer-eval@^1.3.0: + version "1.3.6" + resolved "https://registry.yarnpkg.com/safer-eval/-/safer-eval-1.3.6.tgz#ee51e3348c39fdc4117a47dfb4b69df56a2e40cf" + integrity sha512-DN9tBsZgtUOHODzSfO1nGCLhZtxc7Qq/d8/2SNxQZ9muYXZspSh1fO7HOsrf4lcelBNviAJLCxB/ggmG+jV1aw== + dependencies: + clones "^1.2.0" + sax@~1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -5950,12 +6384,17 @@ scheduler@^0.18.0: loose-envify "^1.1.0" object-assign "^4.1.1" +seed-random@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/seed-random/-/seed-random-2.2.0.tgz#2a9b19e250a817099231a5b99a4daf80b7fbed54" + integrity sha1-KpsZ4lCoFwmSMaW5mk2vgLf77VQ= + semver@7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@^5.4.1, semver@^5.5.0: +semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -5984,6 +6423,14 @@ send@0.17.1, send@^0.17.1: range-parser "~1.2.1" statuses "~1.5.0" +serialize-to-js@^1.1.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/serialize-to-js/-/serialize-to-js-1.2.2.tgz#1a567b0c9bf557bc7d7b77b503dfae0a8218d15d" + integrity sha512-mUc8vA5iJghe+O+3s0YDGFLMJcqitVFk787YKiv8a4sf6RX5W0u81b+gcHrp15O0fFa010dRBVZvwcKXOWsL9Q== + dependencies: + js-beautify "^1.8.9" + safer-eval "^1.3.0" + serialize-to-js@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/serialize-to-js/-/serialize-to-js-3.1.1.tgz#b3e77d0568ee4a60bfe66287f991e104d3a1a4ac" @@ -6059,6 +6506,11 @@ shebang-regex@^1.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= +sigmund@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA= + signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -6467,6 +6919,11 @@ timsort@^0.3.0: resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= +tiny-emitter@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" + integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== + tiny-inflate@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4" @@ -6564,6 +7021,11 @@ trim-repeated@^1.0.0: dependencies: escape-string-regexp "^1.0.2" +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -6588,6 +7050,21 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-detect@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" + integrity sha1-C6XsKohWQORw6k6FBZcZANrFiCI= + +type-detect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" + integrity sha1-diIXzAbbJY7EiQihKY6LlRIejqI= + +typed-function@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-1.1.0.tgz#ea149706e0fb42aca1791c053a6d94ccd6c4fdcb" + integrity sha512-TuQzwiT4DDg19beHam3E66oRXhyqlyfgjHB/5fcvsRXbfmWPJfto9B4a0TBdTrQAPGlGmXh/k7iUI+WsObgORA== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -6917,6 +7394,11 @@ y18n@^4.0.0: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + yargs-parser@^15.0.0: version "15.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.0.tgz#cdd7a97490ec836195f59f3f4dbe5ea9e8f75f08" From b8d036831333e9c45c0735d807a84958bbf811fa Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 12:20:46 +0000 Subject: [PATCH 02/28] Simple visualization of probability distribution --- bsconfig.json | 3 +- package.json | 8 +- src/lib/FormBuilder.re | 5 +- src/lib/Prop.re | 33 +- src/lib/Types.re | 5 + src/utility/CdfLibrary.re | 14 +- src/utility/GuesstimatorLibrary.js | 48 +- yarn.lock | 1009 +++++++++++++++++++++++++++- 8 files changed, 1083 insertions(+), 42 deletions(-) diff --git a/bsconfig.json b/bsconfig.json index 3e1f00ff..be57d770 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -15,6 +15,7 @@ "suffix": ".bs.js", "namespace": true, "bs-dependencies": [ + "@foretold/components", "bs-ant-design-alt", "reason-react", "bs-reform", @@ -25,5 +26,5 @@ "refmt": 3, "ppx-flags": [ "lenses-ppx/ppx" - ], + ] } \ No newline at end of file diff --git a/package.json b/package.json index 40eaad54..f6424815 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "license": "MIT", "dependencies": { "@foretold/cdf": "^1.0.14", + "@foretold/components": "^0.0.3", "@foretold/guesstimator": "^1.0.10", "antd": "3.17.0", "autoprefixer": "^9.7.4", @@ -31,6 +32,7 @@ "bs-reform": "9.7.1", "lenses-ppx": "4.0.0", "less": "^3.10.3", + "lodash": "^4.17.15", "moment": "^2.24.0", "parcel-bundler": "^1.12.4", "parcel-plugin-less-js-enabled": "^1.0.2", @@ -42,10 +44,14 @@ "reschema": "^1.3.0" }, "devDependencies": { - "bs-platform": "^5.0.6", + "bs-platform": "5.2.1", "bsb-js": "^1.1.7", "gh-pages": "^2.2.0", "moduleserve": "^0.9.0", "tailwindcss": "^1.2.0" + }, + "alias": { + "react": "./node_modules/react", + "react-dom": "./node_modules/react-dom" } } diff --git a/src/lib/FormBuilder.re b/src/lib/FormBuilder.re index b54a7d58..0777efe1 100644 --- a/src/lib/FormBuilder.re +++ b/src/lib/FormBuilder.re @@ -51,10 +51,7 @@ module ModelForm = { ) |> ReasonReact.array}
- {model.run(formState.combo) - |> E.O.fmap(Value.to_string) - |> E.O.default("") - |> ReasonReact.string} + {model.run(formState.combo) |> E.O.React.fmapOrNull(Value.display)}
; diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 4d2caffa..ddcae4ff 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -18,12 +18,43 @@ module Value = { | Unselected => "" } | SelectSingle(r) => r - | FloatCdf(r) => r + | FloatCdf(r) => + let foo: Types.distribution = + CdfLibrary.Distribution.fromString(r, 100); + r; | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed }; }; + + let display = (t: t) => { + switch (t) { + | BinaryConditional(binaryConditional) => + ( + switch (binaryConditional) { + | Selected(r) => r ? "True" : "False" + | Unselected => "" + } + ) + |> ReasonReact.string + | SelectSingle(r) => r |> ReasonReact.string + | FloatCdf(r) => + let cdf: Types.distribution = + CdfLibrary.Distribution.fromString(r, 100); + <> + + {r |> ReasonReact.string} + ; + | Probability(r) => + (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string + | DateTime(r) => r |> MomentRe.Moment.defaultFormat |> ReasonReact.string + | FloatPoint(r) => r |> Js.Float.toFixed |> ReasonReact.string + }; + }; }; module Type = { diff --git a/src/lib/Types.re b/src/lib/Types.re index 8d571ade..cd30637a 100644 --- a/src/lib/Types.re +++ b/src/lib/Types.re @@ -1,4 +1,9 @@ type distribution = { xs: array(float), ys: array(float), +}; + +let toComponentsDist = (d: distribution): ForetoldComponents.Types.Dist.t => { + xs: d.xs, + ys: d.ys, }; \ No newline at end of file diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re index 01d20a65..4ea68560 100644 --- a/src/utility/CdfLibrary.re +++ b/src/utility/CdfLibrary.re @@ -14,26 +14,26 @@ module JS = { let doAsDist = (f, d: Types.distribution) => d |> distToJs |> f |> jsToDist; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external cdfToPdf: distJs => distJs = "cdfToPdf"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external pdfToCdf: distJs => distJs = "pdfToCdf"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external findY: (float, distJs) => float = "findY"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external findX: (float, distJs) => float = "findX"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external integral: distJs => float = "integral"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external differentialEntropy: (int, distJs) => distJs = "differentialEntropy"; - [@bs.module "./CdfLibraryImporter.js"] + [@bs.module "./CdfLibrary.js"] external scoreNonMarketCdfCdf: (int, distJs, distJs, float) => distJs = "scoreNonMarketCdfCdf"; diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js index 4109742e..55f12894 100644 --- a/src/utility/GuesstimatorLibrary.js +++ b/src/utility/GuesstimatorLibrary.js @@ -1,18 +1,51 @@ import { Guesstimator } from '@foretold/guesstimator'; import { Samples } from '@foretold/cdf'; +import _ from 'lodash'; -const toPdf = (values, min, max) => { +/** + * + * @param {number} minValue + * @param {number} maxValue + * @returns {string} + */ +const minMaxRatio = (minValue, maxValue) => { + if (minValue === 0 || maxValue === 0) { + return 'SMALL'; + } + const ratio = maxValue / minValue; + if (ratio < 100000) { + return 'SMALL'; + } else if (ratio < 10000000) { + return 'MEDIUM'; + } else { + return 'LARGE'; + } +}; + +/** + * @param samples + * @return {string} + */ +const ratioSize = samples => { + samples.sort(); + const minValue = samples.getPercentile(2); + const maxValue = samples.getPercentile(98); + return minMaxRatio(minValue, maxValue); +}; + +const toPdf = (values, sampleCount, min, max) => { const samples = new Samples(values); const ratioSize$ = ratioSize(samples); const width = ratioSize$ === 'SMALL' ? 20 : 1; - const pdf = samples.toPdf({ size: 1000, width, min, max }); - return {ys:pdf.ys, xs:pdf.xs}; + const cdf = samples.toCdf({ size: sampleCount, width, min, max }); + return {ys:cdf.ys, xs:cdf.xs}; }; let run = (text, sampleCount, inputs=[], min=false, max=false) => { - let [_error, item] = Guesstimator.parse({ text }); + console.log(text); + let [_error, item] = Guesstimator.parse({ text: "=" + text }); const { parsedInput } = item; const { guesstimateType } = parsedInput; @@ -25,18 +58,13 @@ let run = (text, sampleCount, inputs=[], min=false, max=false) => { const values = _.filter(value.values, _.isFinite); - this.setState({ - value: event.target.value, - items: values, - }); - let update; if (values.length === 0) { update = {xs: [], ys: []}; } else if (values.length === 1) { update = {xs: [], ys: []}; } else { - update = toPdf(values, min, max); + update = toPdf(values, sampleCount, min, max); } return update; } diff --git a/yarn.lock b/yarn.lock index 45389c93..1fb67dcc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -860,7 +860,7 @@ dependencies: regenerator-runtime "^0.12.0" -"@babel/runtime@^7.4.4": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.6.3", "@babel/runtime@^7.7.2": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.4.tgz#d79f5a2040f7caa24d53e563aad49cbc05581308" integrity sha512-neAp3zt80trRVBI1x0azq6c57aNBqYZH8KhMm3TaB7wEI5Q4A2SHfBHE8w9gOhI/lrqxtEbXZgQIrHP+wvSGwQ== @@ -933,6 +933,70 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@emotion/cache@^10.0.27": + version "10.0.27" + resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-10.0.27.tgz#7895db204e2c1a991ae33d51262a3a44f6737303" + integrity sha512-Zp8BEpbMunFsTcqAK4D7YTm3MvCp1SekflSLJH8lze2fCcSZ/yMkXHo8kb3t1/1Tdd3hAqf3Fb7z9VZ+FMiC9w== + dependencies: + "@emotion/sheet" "0.9.4" + "@emotion/stylis" "0.8.5" + "@emotion/utils" "0.11.3" + "@emotion/weak-memoize" "0.2.5" + +"@emotion/hash@0.7.4": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.4.tgz#f14932887422c9056b15a8d222a9074a7dfa2831" + integrity sha512-fxfMSBMX3tlIbKUdtGKxqB1fyrH6gVrX39Gsv3y8lRYKUqlgDt3UMqQyGnR1bQMa2B8aGnhLZokZgg8vT0Le+A== + +"@emotion/memoize@0.7.4": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb" + integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw== + +"@emotion/serialize@^0.11.15": + version "0.11.15" + resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.11.15.tgz#9a0f5873fb458d87d4f23e034413c12ed60a705a" + integrity sha512-YE+qnrmGwyR+XB5j7Bi+0GT1JWsdcjM/d4POu+TXkcnrRs4RFCCsi3d/Ebf+wSStHqAlTT2+dfd+b9N9EO2KBg== + dependencies: + "@emotion/hash" "0.7.4" + "@emotion/memoize" "0.7.4" + "@emotion/unitless" "0.7.5" + "@emotion/utils" "0.11.3" + csstype "^2.5.7" + +"@emotion/sheet@0.9.4": + version "0.9.4" + resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.4.tgz#894374bea39ec30f489bbfc3438192b9774d32e5" + integrity sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA== + +"@emotion/stylis@0.8.5": + version "0.8.5" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.5.tgz#deacb389bd6ee77d1e7fcaccce9e16c5c7e78e04" + integrity sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ== + +"@emotion/unitless@0.7.5": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" + integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== + +"@emotion/utils@0.11.3": + version "0.11.3" + resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.11.3.tgz#a759863867befa7e583400d322652a3f44820924" + integrity sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw== + +"@emotion/weak-memoize@0.2.5": + version "0.2.5" + resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz#8eed982e2ee6f7f4e44c253e12962980791efd46" + integrity sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA== + +"@foretold/cdf@1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@foretold/cdf/-/cdf-1.0.10.tgz#e068062be6983e220439f887b66da2f6147eff53" + integrity sha512-a8cUCdWjZViimKTROJIwA1j0//AWeYg2wP79ZARtpwdMq1oMEyHCA4N9iYmkkz/R/kUkBjO5p1NQ+/+O1W1Y9g== + dependencies: + lodash "4.17.15" + pdfast "0.2.0" + "@foretold/cdf@^1.0.14": version "1.0.14" resolved "https://registry.yarnpkg.com/@foretold/cdf/-/cdf-1.0.14.tgz#a6b77a1fa211e3b5b8b3f75fbe1979499287eb89" @@ -942,6 +1006,42 @@ parcel "1.12.3" pdfast "0.2.0" +"@foretold/components@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@foretold/components/-/components-0.0.3.tgz#a195912647499735f64cb2b74f722eee4b2da13f" + integrity sha512-erCJ8d5H+sJ7RGIoQCHTRaKiSQlTS9yIM4Ku6hOw+8Y+5bawptRuitoeqoReqwRlcuNZSSqwWOufkoc+GiXrbg== + dependencies: + "@foretold/cdf" "1.0.10" + "@foretold/guesstimator" "1.0.1" + bs-css "11.0.0" + bs-moment "0.4.4" + bs-platform "5.0.6" + d3 "5.9.2" + emotion "10.0.9" + lodash "4.17.15" + moment "2.24.0" + rationale "0.2.0" + rc-dropdown "2.4.1" + rc-menu "7.4.20" + react "16.12.0" + react-dom "16.12.0" + react-icons-kit "^1.3.1" + react-textarea-autosize "7.1.2" + react-use "13.19.0" + reason-apollo "0.18.0" + reason-react "0.7.0" + +"@foretold/guesstimator@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@foretold/guesstimator/-/guesstimator-1.0.1.tgz#6c061474a0b453eb5e8caa17912689262175185e" + integrity sha512-jrwOthO9YhC3rb4l4OPJl3kOB4192fW4sPqHJz9pqzoBlRWKZVeSg91fFQMSsSr/MEvAtycYLU/WRqWkmZsCoQ== + dependencies: + discrete-sampling "1.0.3" + financejs "4.1.0" + jstat "1.9.0" + lodash "4.17.15" + mathjs "5.10.3" + "@foretold/guesstimator@^1.0.10": version "1.0.10" resolved "https://registry.yarnpkg.com/@foretold/guesstimator/-/guesstimator-1.0.10.tgz#8b3bf5371c836de6db31832a88a2c1f0eb4d3111" @@ -1061,6 +1161,11 @@ "@types/react" "*" hoist-non-react-statics "^3.3.0" +"@types/js-cookie@2.2.4": + version "2.2.4" + resolved "https://registry.yarnpkg.com/@types/js-cookie/-/js-cookie-2.2.4.tgz#f79720b4755aa197c2e15e982e2f438f5748e348" + integrity sha512-WTfSE1Eauak/Nrg6cA9FgPTFvVawejsai6zXoq0QYTQ3mxONeRtGhKxa7wMlUzWWmzrmTeV+rwLjHgsCntdrsA== + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" @@ -1071,6 +1176,16 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.0.tgz#b417deda18cf8400f278733499ad5547ed1abec4" integrity sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ== +"@types/node@>=6": + version "13.7.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d" + integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA== + +"@types/parse-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" + integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== + "@types/prop-types@*": version "15.7.3" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" @@ -1096,6 +1211,31 @@ "@types/prop-types" "*" csstype "^2.2.0" +"@types/zen-observable@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.0.tgz#8b63ab7f1aa5321248aad5ac890a485656dcea4d" + integrity sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg== + +"@wry/context@^0.4.0": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.4.4.tgz#e50f5fa1d6cfaabf2977d1fda5ae91717f8815f8" + integrity sha512-LrKVLove/zw6h2Md/KZyWxIkFM6AoyKp71OqpH9Hiip1csjPVoD3tPxlbQUNxEnHENks3UGgNpSBCAfq9KWuag== + dependencies: + "@types/node" ">=6" + tslib "^1.9.3" + +"@wry/equality@^0.1.2": + version "0.1.9" + resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.1.9.tgz#b13e18b7a8053c6858aa6c85b54911fb31e3a909" + integrity sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ== + dependencies: + tslib "^1.9.3" + +"@xobotyi/scrollbar-width@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@xobotyi/scrollbar-width/-/scrollbar-width-1.5.0.tgz#488210bff634548040dc22a72f62722a85b134e1" + integrity sha512-BK+HR1D00F2xh7n4+5en8/dMkG13uvIXLmEbsjtc1702b7+VwXkvlBDKoRPJMbkRN5hD7VqWa3nS9fNT8JG3CA== + abab@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" @@ -1298,6 +1438,111 @@ anymatch@~3.1.1: normalize-path "^3.0.0" picomatch "^2.0.4" +apollo-cache-inmemory@^1.6.0: + version "1.6.5" + resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.6.5.tgz#2ccaa3827686f6ed7fb634203dbf2b8d7015856a" + integrity sha512-koB76JUDJaycfejHmrXBbWIN9pRKM0Z9CJGQcBzIOtmte1JhEBSuzsOUu7NQgiXKYI4iGoMREcnaWffsosZynA== + dependencies: + apollo-cache "^1.3.4" + apollo-utilities "^1.3.3" + optimism "^0.10.0" + ts-invariant "^0.4.0" + tslib "^1.10.0" + +apollo-cache@1.3.4, apollo-cache@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.3.4.tgz#0c9f63c793e1cd6e34c450f7668e77aff58c9a42" + integrity sha512-7X5aGbqaOWYG+SSkCzJNHTz2ZKDcyRwtmvW4mGVLRqdQs+HxfXS4dUS2CcwrAj449se6tZ6NLUMnjko4KMt3KA== + dependencies: + apollo-utilities "^1.3.3" + tslib "^1.10.0" + +apollo-client@^2.6.3: + version "2.6.8" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.6.8.tgz#01cebc18692abf90c6b3806414e081696b0fa537" + integrity sha512-0zvJtAcONiozpa5z5zgou83iEKkBaXhhSSXJebFHRXs100SecDojyUWKjwTtBPn9HbM6o5xrvC5mo9VQ5fgAjw== + dependencies: + "@types/zen-observable" "^0.8.0" + apollo-cache "1.3.4" + apollo-link "^1.0.0" + apollo-utilities "1.3.3" + symbol-observable "^1.0.2" + ts-invariant "^0.4.0" + tslib "^1.10.0" + zen-observable "^0.8.0" + +apollo-link-context@^1.0.18: + version "1.0.19" + resolved "https://registry.yarnpkg.com/apollo-link-context/-/apollo-link-context-1.0.19.tgz#3c9ba5bf75ed5428567ce057b8837ef874a58987" + integrity sha512-TUi5TyufU84hEiGkpt+5gdH5HkB3Gx46npNfoxR4of3DKBCMuItGERt36RCaryGcU/C3u2zsICU3tJ+Z9LjFoQ== + dependencies: + apollo-link "^1.2.13" + tslib "^1.9.3" + +apollo-link-error@^1.1.11: + version "1.1.12" + resolved "https://registry.yarnpkg.com/apollo-link-error/-/apollo-link-error-1.1.12.tgz#e24487bb3c30af0654047611cda87038afbacbf9" + integrity sha512-psNmHyuy3valGikt/XHJfe0pKJnRX19tLLs6P6EHRxg+6q6JMXNVLYPaQBkL0FkwdTCB0cbFJAGRYCBviG8TDA== + dependencies: + apollo-link "^1.2.13" + apollo-link-http-common "^0.2.15" + tslib "^1.9.3" + +apollo-link-http-common@^0.2.15, apollo-link-http-common@^0.2.5: + version "0.2.15" + resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.15.tgz#304e67705122bf69a9abaded4351b10bc5efd6d9" + integrity sha512-+Heey4S2IPsPyTf8Ag3PugUupASJMW894iVps6hXbvwtg1aHSNMXUYO5VG7iRHkPzqpuzT4HMBanCTXPjtGzxg== + dependencies: + apollo-link "^1.2.13" + ts-invariant "^0.4.0" + tslib "^1.9.3" + +apollo-link-http@^1.5.15: + version "1.5.16" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.5.16.tgz#44fe760bcc2803b8a7f57fc9269173afb00f3814" + integrity sha512-IA3xA/OcrOzINRZEECI6IdhRp/Twom5X5L9jMehfzEo2AXdeRwAMlH5LuvTZHgKD8V1MBnXdM6YXawXkTDSmJw== + dependencies: + apollo-link "^1.2.13" + apollo-link-http-common "^0.2.15" + tslib "^1.9.3" + +apollo-link-ws@^1.0.18: + version "1.0.19" + resolved "https://registry.yarnpkg.com/apollo-link-ws/-/apollo-link-ws-1.0.19.tgz#dfa871d4df883a8777c9556c872fc892e103daa5" + integrity sha512-mRXmeUkc55ixOdYRtfq5rq3o9sboKghKABKroDVhJnkdS56zthBEWMAD+phajujOUbqByxjok0te8ABqByBdeQ== + dependencies: + apollo-link "^1.2.13" + tslib "^1.9.3" + +apollo-link@^1.0.0, apollo-link@^1.2.12, apollo-link@^1.2.13, apollo-link@^1.2.3: + version "1.2.13" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.13.tgz#dff00fbf19dfcd90fddbc14b6a3f9a771acac6c4" + integrity sha512-+iBMcYeevMm1JpYgwDEIDt/y0BB7VWyvlm/7x+TIPNLHCTCMgcEgDuW5kH86iQZWo0I7mNwQiTOz+/3ShPFmBw== + dependencies: + apollo-utilities "^1.3.0" + ts-invariant "^0.4.0" + tslib "^1.9.3" + zen-observable-ts "^0.8.20" + +apollo-upload-client@9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/apollo-upload-client/-/apollo-upload-client-9.1.0.tgz#13191714ae07388088f2c773ebbfd53ba2f64c53" + integrity sha512-ZN5gsbBjImEZTWWTUHpCEGDasnoBGbaODpznQ5EawyNHceuFYSNJbbft+ZZ841vZAcj9XZdKUKoaLBlMZ/r7nw== + dependencies: + apollo-link "^1.2.3" + apollo-link-http-common "^0.2.5" + extract-files "^4.0.0" + +apollo-utilities@1.3.3, apollo-utilities@^1.3.0, apollo-utilities@^1.3.2, apollo-utilities@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.3.tgz#f1854715a7be80cd810bc3ac95df085815c0787c" + integrity sha512-F14aX2R/fKNYMvhuP2t9GD9fggID7zp5I96MF5QeKYWDWTrkRdHRp4+SVfXUVN+cXOaB/IebfvRtzPf25CM0zw== + dependencies: + "@wry/equality" "^0.1.2" + fast-json-stable-stringify "^2.0.0" + ts-invariant "^0.4.0" + tslib "^1.10.0" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1458,6 +1703,36 @@ babel-plugin-dynamic-import-node@^2.3.0: dependencies: object.assign "^4.1.0" +babel-plugin-emotion@^10.0.27, babel-plugin-emotion@^10.0.9: + version "10.0.27" + resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.27.tgz#59001cf5de847c1d61f2079cd906a90a00d3184f" + integrity sha512-SUNYcT4FqhOqvwv0z1oeYhqgheU8qrceLojuHyX17ngo7WtWqN5I9l3IGHzf21Xraj465CVzF4IvOlAF+3ed0A== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@emotion/hash" "0.7.4" + "@emotion/memoize" "0.7.4" + "@emotion/serialize" "^0.11.15" + babel-plugin-macros "^2.0.0" + babel-plugin-syntax-jsx "^6.18.0" + convert-source-map "^1.5.0" + escape-string-regexp "^1.0.5" + find-root "^1.1.0" + source-map "^0.5.7" + +babel-plugin-macros@^2.0.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138" + integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg== + dependencies: + "@babel/runtime" "^7.7.2" + cosmiconfig "^6.0.0" + resolve "^1.12.0" + +babel-plugin-syntax-jsx@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" + integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY= + babel-runtime@6.x, babel-runtime@^6.11.6, babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -1485,6 +1760,11 @@ babylon-walk@^1.0.2: babel-types "^6.15.0" lodash.clone "^4.5.0" +backo2@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" + integrity sha1-MasayLEpNjRj41s+u2n038+6eUc= + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -1542,6 +1822,11 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= +bowser@^1.7.3: + version "1.9.4" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a" + integrity sha512-9IdMmj2KjigRq6oWhmwv1W36pDuA4STQZ8q6YO9um+x07xgYNCD3Oou+WP/3L1HNz7iqythGet3/p4wvc8AAwQ== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1670,6 +1955,13 @@ bs-ant-design-alt@2.0.0-alpha.31: bs-moment "^0.4.4" re-classnames "^4.0.0" +bs-css@11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/bs-css/-/bs-css-11.0.0.tgz#6ed1726d7c06aa584d255d1cf23240a2acc0aa07" + integrity sha512-bpSwj1VvmWNMoJ5qnsHMQC+Mj0zjL9iwcOhl5ipP7Hfr7v+ZyKqjSMaMK+L1EdukuCp0rJmRD2I/MbS4BHnMmQ== + dependencies: + emotion "^10.0.7" + bs-moment@0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/bs-moment/-/bs-moment-0.4.4.tgz#3d59767e8cd0107393c4f371e15b95bf862ceaac" @@ -1680,7 +1972,12 @@ bs-moment@^0.4.4: resolved "https://registry.yarnpkg.com/bs-moment/-/bs-moment-0.4.5.tgz#3f84fed55c2a70d25b0b6025e4e8d821fcdd4dc8" integrity sha512-anPYkFSof+X8EeomnP0fbQBvWFJeganwPqqARVB+fcdKYX2Uog/n3CCiFGEA+66yHbwnWZD5YFhtHCuyLMcQfQ== -bs-platform@^5.0.6: +bs-platform@5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-5.0.6.tgz#88c13041fb020479800de3d82c680bf971091425" + integrity sha512-6Boa2VEcWJp2WJr38L7bp3J929nYha7gDarjxb070jWzgfPJ/WbzjipmSfnu2eqqk1MfjEIpBipbPz6n1NISwA== + +bs-platform@5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-5.2.1.tgz#3f76f6d4f4c7255296375a8104c8be332770b691" integrity sha512-3ISP+RBC/NYILiJnphCY0W3RTYpQ11JGa2dBBLVug5fpFZ0qtSaL3ZplD8MyjNeXX2bC7xgrWfgBSn8Tc9om7Q== @@ -1772,6 +2069,19 @@ callsites@^2.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" + integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.1" + camelcase-css@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" @@ -2010,7 +2320,7 @@ command-exists@^1.2.6: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.8.tgz#715acefdd1223b9c9b37110a149c6392c2852291" integrity sha512-PM54PkseWbiiD/mMsbvW351/u+dafwTJ0ye2qB60G1aGQP9j3xK2gmMDc+R34L3nDtx4qMCitXT75mkbkGJDLw== -commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0: +commander@2, commander@^2.11.0, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -2070,7 +2380,7 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= -convert-source-map@^1.1.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0: +convert-source-map@^1.1.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -2082,7 +2392,7 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-to-clipboard@^3.0.8: +copy-to-clipboard@^3.0.8, copy-to-clipboard@^3.2.0: version "3.2.1" resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.2.1.tgz#b1a1137100e5665d5a96015cb579e30e90e07c44" integrity sha512-btru1Q6RD9wbonIvEU5EfnhIRGHLo//BGXQ1hNAD2avIs/nBZlpbOeKtv3mhoUByN4DB9Cb6/vXBymj1S43KmA== @@ -2122,6 +2432,17 @@ cosmiconfig@^5.0.0: js-yaml "^3.13.1" parse-json "^4.0.0" +cosmiconfig@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982" + integrity sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.1.0" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.7.2" + create-ecdh@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" @@ -2130,6 +2451,16 @@ create-ecdh@^4.0.0: bn.js "^4.1.0" elliptic "^6.0.0" +create-emotion@^10.0.27, create-emotion@^10.0.9: + version "10.0.27" + resolved "https://registry.yarnpkg.com/create-emotion/-/create-emotion-10.0.27.tgz#cb4fa2db750f6ca6f9a001a33fbf1f6c46789503" + integrity sha512-fIK73w82HPPn/RsAij7+Zt8eCE8SptcJ3WoRMfxMtjteYxud8GDTKKld7MYwAX2TVhrw29uR1N/bVGxeStHILg== + dependencies: + "@emotion/cache" "^10.0.27" + "@emotion/serialize" "^0.11.15" + "@emotion/sheet" "0.9.4" + "@emotion/utils" "0.11.3" + create-hash@^1.1.0, create-hash@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -2211,6 +2542,14 @@ css-declaration-sorter@^4.0.1: postcss "^7.0.1" timsort "^0.3.0" +css-in-js-utils@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/css-in-js-utils/-/css-in-js-utils-2.0.1.tgz#3b472b398787291b47cfe3e44fecfdd9e914ba99" + integrity sha512-PJF0SpJT+WdbVVt0AOYp9C8GnuruRlL/UFW7932nLWmFLQTaWEzTBQEx7/hn4BuV+WON75iAViSUJLiU3PKbpA== + dependencies: + hyphenate-style-name "^1.0.2" + isobject "^3.0.1" + css-modules-loader-core@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/css-modules-loader-core/-/css-modules-loader-core-1.1.0.tgz#5908668294a1becd261ae0a4ce21b0b551f21d16" @@ -2255,6 +2594,14 @@ css-tree@1.0.0-alpha.37: mdn-data "2.0.4" source-map "^0.6.1" +css-tree@^1.0.0-alpha.28: + version "1.0.0-alpha.39" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.39.tgz#2bff3ffe1bb3f776cf7eefd91ee5cba77a149eeb" + integrity sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA== + dependencies: + mdn-data "2.0.6" + source-map "^0.6.1" + css-unit-converter@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.1.tgz#d9b9281adcfd8ced935bdbaba83786897f64e996" @@ -2367,11 +2714,259 @@ cssstyle@^1.1.1: dependencies: cssom "0.3.x" -csstype@^2.2.0: +csstype@^2.2.0, csstype@^2.5.5, csstype@^2.5.7: version "2.6.8" resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.8.tgz#0fb6fc2417ffd2816a418c9336da74d7f07db431" integrity sha512-msVS9qTuMT5zwAGCVm4mxfrZ18BNc6Csd0oJAtiFMZ1FAx1CCvy2+5MDmYoix63LM/6NDbNtodCiGYGmFgO0dA== +d3-array@1, d3-array@^1.1.1, d3-array@^1.2.0: + version "1.2.4" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f" + integrity sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw== + +d3-axis@1: + version "1.0.12" + resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-1.0.12.tgz#cdf20ba210cfbb43795af33756886fb3638daac9" + integrity sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ== + +d3-brush@1: + version "1.1.5" + resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-1.1.5.tgz#066b8e84d17b192986030446c97c0fba7e1bacdc" + integrity sha512-rEaJ5gHlgLxXugWjIkolTA0OyMvw8UWU1imYXy1v642XyyswmI1ybKOv05Ft+ewq+TFmdliD3VuK0pRp1VT/5A== + dependencies: + d3-dispatch "1" + d3-drag "1" + d3-interpolate "1" + d3-selection "1" + d3-transition "1" + +d3-chord@1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-1.0.6.tgz#309157e3f2db2c752f0280fedd35f2067ccbb15f" + integrity sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA== + dependencies: + d3-array "1" + d3-path "1" + +d3-collection@1: + version "1.0.7" + resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.7.tgz#349bd2aa9977db071091c13144d5e4f16b5b310e" + integrity sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A== + +d3-color@1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.4.0.tgz#89c45a995ed773b13314f06460df26d60ba0ecaf" + integrity sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg== + +d3-contour@1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-1.3.2.tgz#652aacd500d2264cb3423cee10db69f6f59bead3" + integrity sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg== + dependencies: + d3-array "^1.1.1" + +d3-dispatch@1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.6.tgz#00d37bcee4dd8cd97729dd893a0ac29caaba5d58" + integrity sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA== + +d3-drag@1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-1.2.5.tgz#2537f451acd39d31406677b7dc77c82f7d988f70" + integrity sha512-rD1ohlkKQwMZYkQlYVCrSFxsWPzI97+W+PaEIBNTMxRuxz9RF0Hi5nJWHGVJ3Om9d2fRTe1yOBINJyy/ahV95w== + dependencies: + d3-dispatch "1" + d3-selection "1" + +d3-dsv@1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.2.0.tgz#9d5f75c3a5f8abd611f74d3f5847b0d4338b885c" + integrity sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g== + dependencies: + commander "2" + iconv-lite "0.4" + rw "1" + +d3-ease@1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-1.0.6.tgz#ebdb6da22dfac0a22222f2d4da06f66c416a0ec0" + integrity sha512-SZ/lVU7LRXafqp7XtIcBdxnWl8yyLpgOmzAk0mWBI9gXNzLDx5ybZgnRbH9dN/yY5tzVBqCQ9avltSnqVwessQ== + +d3-fetch@1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/d3-fetch/-/d3-fetch-1.1.2.tgz#957c8fbc6d4480599ba191b1b2518bf86b3e1be2" + integrity sha512-S2loaQCV/ZeyTyIF2oP8D1K9Z4QizUzW7cWeAOAS4U88qOt3Ucf6GsmgthuYSdyB2HyEm4CeGvkQxWsmInsIVA== + dependencies: + d3-dsv "1" + +d3-force@1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-1.2.1.tgz#fd29a5d1ff181c9e7f0669e4bd72bdb0e914ec0b" + integrity sha512-HHvehyaiUlVo5CxBJ0yF/xny4xoaxFxDnBXNvNcfW9adORGZfyNF1dj6DGLKyk4Yh3brP/1h3rnDzdIAwL08zg== + dependencies: + d3-collection "1" + d3-dispatch "1" + d3-quadtree "1" + d3-timer "1" + +d3-format@1: + version "1.4.3" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.4.3.tgz#4e8eb4dff3fdcb891a8489ec6e698601c41b96f1" + integrity sha512-mm/nE2Y9HgGyjP+rKIekeITVgBtX97o1nrvHCWX8F/yBYyevUTvu9vb5pUnKwrcSw7o7GuwMOWjS9gFDs4O+uQ== + +d3-geo@1: + version "1.11.9" + resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.11.9.tgz#77eaed14ba62fc2c0aef55cd2943849c866f7ae6" + integrity sha512-9edcH6J3s/Aa3KJITWqFJbyB/8q3mMlA9Fi7z6yy+FAYMnRaxmC7jBhUnsINxVWD14GmqX3DK8uk7nV6/Ekt4A== + dependencies: + d3-array "1" + +d3-hierarchy@1: + version "1.1.9" + resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.9.tgz#2f6bee24caaea43f8dc37545fa01628559647a83" + integrity sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ== + +d3-interpolate@1: + version "1.4.0" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.4.0.tgz#526e79e2d80daa383f9e0c1c1c7dcc0f0583e987" + integrity sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA== + dependencies: + d3-color "1" + +d3-path@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf" + integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg== + +d3-polygon@1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-1.0.6.tgz#0bf8cb8180a6dc107f518ddf7975e12abbfbd38e" + integrity sha512-k+RF7WvI08PC8reEoXa/w2nSg5AUMTi+peBD9cmFc+0ixHfbs4QmxxkarVal1IkVkgxVuk9JSHhJURHiyHKAuQ== + +d3-quadtree@1: + version "1.0.7" + resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.7.tgz#ca8b84df7bb53763fe3c2f24bd435137f4e53135" + integrity sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA== + +d3-random@1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.2.tgz#2833be7c124360bf9e2d3fd4f33847cfe6cab291" + integrity sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ== + +d3-scale-chromatic@1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-1.5.0.tgz#54e333fc78212f439b14641fb55801dd81135a98" + integrity sha512-ACcL46DYImpRFMBcpk9HhtIyC7bTBR4fNOPxwVSl0LfulDAwyiHyPOTqcDG1+t5d4P9W7t/2NAuWu59aKko/cg== + dependencies: + d3-color "1" + d3-interpolate "1" + +d3-scale@2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-2.2.2.tgz#4e880e0b2745acaaddd3ede26a9e908a9e17b81f" + integrity sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw== + dependencies: + d3-array "^1.2.0" + d3-collection "1" + d3-format "1" + d3-interpolate "1" + d3-time "1" + d3-time-format "2" + +d3-selection@1, d3-selection@^1.1.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.4.1.tgz#98eedbbe085fbda5bafa2f9e3f3a2f4d7d622a98" + integrity sha512-BTIbRjv/m5rcVTfBs4AMBLKs4x8XaaLkwm28KWu9S2vKNqXkXt2AH2Qf0sdPZHjFxcWg/YL53zcqAz+3g4/7PA== + +d3-shape@1: + version "1.3.7" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7" + integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw== + dependencies: + d3-path "1" + +d3-time-format@2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.2.3.tgz#0c9a12ee28342b2037e5ea1cf0b9eb4dd75f29cb" + integrity sha512-RAHNnD8+XvC4Zc4d2A56Uw0yJoM7bsvOlJR33bclxq399Rak/b9bhvu/InjxdWhPtkgU53JJcleJTGkNRnN6IA== + dependencies: + d3-time "1" + +d3-time@1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.1.0.tgz#b1e19d307dae9c900b7e5b25ffc5dcc249a8a0f1" + integrity sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA== + +d3-timer@1: + version "1.0.10" + resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.10.tgz#dfe76b8a91748831b13b6d9c793ffbd508dd9de5" + integrity sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw== + +d3-transition@1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-1.3.2.tgz#a98ef2151be8d8600543434c1ca80140ae23b398" + integrity sha512-sc0gRU4PFqZ47lPVHloMn9tlPcv8jxgOQg+0zjhfZXMQuvppjG6YuwdMBE0TuqCZjeJkLecku/l9R0JPcRhaDA== + dependencies: + d3-color "1" + d3-dispatch "1" + d3-ease "1" + d3-interpolate "1" + d3-selection "^1.1.0" + d3-timer "1" + +d3-voronoi@1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.4.tgz#dd3c78d7653d2bb359284ae478645d95944c8297" + integrity sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg== + +d3-zoom@1: + version "1.8.3" + resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-1.8.3.tgz#b6a3dbe738c7763121cd05b8a7795ffe17f4fc0a" + integrity sha512-VoLXTK4wvy1a0JpH2Il+F2CiOhVu7VRXWF5M/LroMIh3/zBAC3WAt7QoIvPibOavVo20hN6/37vwAsdBejLyKQ== + dependencies: + d3-dispatch "1" + d3-drag "1" + d3-interpolate "1" + d3-selection "1" + d3-transition "1" + +d3@5.9.2: + version "5.9.2" + resolved "https://registry.yarnpkg.com/d3/-/d3-5.9.2.tgz#64e8a7e9c3d96d9e6e4999d2c8a2c829767e67f5" + integrity sha512-ydrPot6Lm3nTWH+gJ/Cxf3FcwuvesYQ5uk+j/kXEH/xbuYWYWTMAHTJQkyeuG8Y5WM5RSEYB41EctUrXQQytRQ== + dependencies: + d3-array "1" + d3-axis "1" + d3-brush "1" + d3-chord "1" + d3-collection "1" + d3-color "1" + d3-contour "1" + d3-dispatch "1" + d3-drag "1" + d3-dsv "1" + d3-ease "1" + d3-fetch "1" + d3-force "1" + d3-format "1" + d3-geo "1" + d3-hierarchy "1" + d3-interpolate "1" + d3-path "1" + d3-polygon "1" + d3-quadtree "1" + d3-random "1" + d3-scale "2" + d3-scale-chromatic "1" + d3-selection "1" + d3-shape "1" + d3-time "1" + d3-time-format "2" + d3-timer "1" + d3-transition "1" + d3-voronoi "1" + d3-zoom "1" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -2699,6 +3294,22 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emotion@10.0.9: + version "10.0.9" + resolved "https://registry.yarnpkg.com/emotion/-/emotion-10.0.9.tgz#2c37598af13df31dcd35a1957eaa8830f368c066" + integrity sha512-IMFwwWlU2TDt7eh4v6dm58E8VHAYOitqRbVoazQdxIu9/0CAH4a3UrTMnZSlWQAo09MrRRlKfgQFHswnj40meQ== + dependencies: + babel-plugin-emotion "^10.0.9" + create-emotion "^10.0.9" + +emotion@^10.0.7: + version "10.0.27" + resolved "https://registry.yarnpkg.com/emotion/-/emotion-10.0.27.tgz#f9ca5df98630980a23c819a56262560562e5d75e" + integrity sha512-2xdDzdWWzue8R8lu4G76uWX5WhyQuzATon9LmNeCy/2BHVC6dsEpfhN1a0qhELgtDVdjyEA6J8Y/VlI5ZnaH0g== + dependencies: + babel-plugin-emotion "^10.0.27" + create-emotion "^10.0.27" + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -2745,6 +3356,13 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +error-stack-parser@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.6.tgz#5a99a707bd7a4c58a797902d48d82803ede6aad8" + integrity sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ== + dependencies: + stackframe "^1.1.1" + es-abstract@^1.17.0-next.1, es-abstract@^1.17.2: version "1.17.4" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184" @@ -2835,6 +3453,11 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +eventemitter3@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + eventlistener@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/eventlistener/-/eventlistener-0.0.1.tgz#ed2baabb852227af2bcf889152c72c63ca532eb8" @@ -2900,6 +3523,11 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-files@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-4.1.0.tgz#2d5b64af688dfd030274ca542c43fabba325019a" + integrity sha512-2gjdb3dVzr1ie9+K8pupPTnsNkK4qmzbTFOIxghiWoh6nCTajGCGC72ZNYX0nBWy5IOq1FXfRVgvkkLqqE4sdw== + extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -2958,6 +3586,16 @@ fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-shallow-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-shallow-equal/-/fast-shallow-equal-1.0.0.tgz#d4dcaf6472440dcefa6f88b98e3251e27f25628b" + integrity sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw== + +fastest-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fastest-stable-stringify/-/fastest-stable-stringify-1.0.1.tgz#9122d406d4c9d98bea644a6b6853d5874b87b028" + integrity sha1-kSLUBtTJ2YvqZEpraFPVh0uHsCg= + fastparse@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9" @@ -3037,6 +3675,11 @@ financejs@4.1.0: resolved "https://registry.yarnpkg.com/financejs/-/financejs-4.1.0.tgz#e69b7cf4f0b5dd0c8a3b041992439513a2b93c41" integrity sha1-5pt89PC13QyKOwQZkkOVE6K5PEE= +find-root@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" + integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== + find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -3244,6 +3887,18 @@ grapheme-breaker@^0.3.2: brfs "^1.2.0" unicode-trie "^0.3.1" +graphql-tag@^2.10.0: + version "2.10.3" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.3.tgz#ea1baba5eb8fc6339e4c4cf049dabe522b0edf03" + integrity sha512-4FOv3ZKfA4WdOKJeHdz6B3F/vxBLSgmBcGeAFPf4n1F64ltJUvOOerNj0rsJxONQGdhUMynQIvd6LzB+1J5oKA== + +graphql@^14.0.2: + version "14.6.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-14.6.0.tgz#57822297111e874ea12f5cd4419616930cd83e49" + integrity sha512-VKzfvHEKybTKjQVpTFrA5yUq2S9ihcZvfJAtsDBBCuV6wauPu1xl/f9ehgVf0FcEJJs4vz6ysb/ZMkGigQZseg== + dependencies: + iterall "^1.2.2" + gud@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" @@ -3460,7 +4115,12 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -iconv-lite@0.4.24, iconv-lite@~0.4.13: +hyphenate-style-name@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz#097bb7fa0b8f1a9cf0bd5c734cf95899981a9b48" + integrity sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ== + +iconv-lite@0.4, iconv-lite@0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3512,6 +4172,14 @@ import-fresh@^2.0.0: caller-path "^2.0.0" resolve-from "^3.0.0" +import-fresh@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-from@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" @@ -3552,6 +4220,14 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== +inline-style-prefixer@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/inline-style-prefixer/-/inline-style-prefixer-4.0.2.tgz#d390957d26f281255fe101da863158ac6eb60911" + integrity sha512-N8nVhwfYga9MiV9jWlwfdj1UDIaZlBFu4cJSJkIr7tZX7sHpHhGR5su1qdpW+7KPL8ISTvCIkcaFi/JdBknvPg== + dependencies: + bowser "^1.7.3" + css-in-js-utils "^2.0.0" + invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -3839,6 +4515,11 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= +iterall@^1.2.1, iterall@^1.2.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.3.0.tgz#afcb08492e2915cbd8a0884eb93a8c94d0d72fea" + integrity sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg== + javascript-natural-sort@0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" @@ -3855,6 +4536,11 @@ js-beautify@^1.8.9: mkdirp "~0.5.1" nopt "~4.0.1" +js-cookie@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8" + integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ== + js-levenshtein@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" @@ -4048,6 +4734,11 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -4073,6 +4764,11 @@ lodash.debounce@^4.0.0, lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -4117,6 +4813,11 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4 dependencies: js-tokens "^3.0.0 || ^4.0.0" +lower-case@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" + integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= + lru-cache@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" @@ -4172,6 +4873,11 @@ mdn-data@2.0.4: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.4.tgz#699b3c38ac6f1d728091a64650b65d388502fd5b" integrity sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA== +mdn-data@2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.6.tgz#852dc60fcaa5daa2e8cf6c9189c440ed3e042978" + integrity sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA== + merge-source-map@1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.4.tgz#a5de46538dae84d4114cc5ea02b4772a6346701f" @@ -4301,7 +5007,7 @@ moduleserve@^0.9.0: send "^0.17.1" serve-static "^1.14.1" -moment@2.x, moment@^2.24.0: +moment@2.24.0, moment@2.x, moment@^2.24.0: version "2.24.0" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== @@ -4331,6 +5037,20 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== +nano-css@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/nano-css/-/nano-css-5.2.1.tgz#73b8470fa40b028a134d3393ae36bbb34b9fa332" + integrity sha512-T54okxMAha0+de+W8o3qFtuWhTxYvqQh2ku1cYEqTTP9mR62nWV2lLK9qRuAGWmoaYWhU7K4evT9Lc1iF65wuw== + dependencies: + css-tree "^1.0.0-alpha.28" + csstype "^2.5.5" + fastest-stable-stringify "^1.0.1" + inline-style-prefixer "^4.0.0" + rtl-css-js "^1.9.0" + sourcemap-codec "^1.4.1" + stacktrace-js "^2.0.0" + stylis "3.5.0" + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -4353,6 +5073,13 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +no-case@^2.2.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" + integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== + dependencies: + lower-case "^1.1.1" + node-addon-api@^1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.1.tgz#cf813cd69bb8d9100f6bdca6755fc268f54ac492" @@ -4592,6 +5319,13 @@ opn@^5.1.0: dependencies: is-wsl "^1.1.0" +optimism@^0.10.0: + version "0.10.3" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.10.3.tgz#163268fdc741dea2fb50f300bedda80356445fd7" + integrity sha512-9A5pqGoQk49H6Vhjb9kPgAeeECfUDF6aIICbMDL23kDLStBn1MWk3YvcZ4xWF9CsSf6XEgvRLkXy4xof/56vVw== + dependencies: + "@wry/context" "^0.4.0" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -4810,6 +5544,13 @@ parcel@1.12.3: v8-compile-cache "^2.0.0" ws "^5.1.1" +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-asn1@^5.0.0: version "5.1.5" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" @@ -4830,6 +5571,16 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + parse5@5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" @@ -5413,7 +6164,7 @@ promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.2: +prop-types@15.x, prop-types@^15.5.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -5543,7 +6294,7 @@ range-parser@~1.2.1: resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -rationale@^0.2.0: +rationale@0.2.0, rationale@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/rationale/-/rationale-0.2.0.tgz#555ed4f3cc7cd0245faeac041d3769f1857e4f3d" integrity sha512-Pd8w5Inv1JhTfRyx03zs486CEAn6UKXvvOtxVRLsewngsBSffo3MQwUKYS75L/8vPt98wmf7iaZROx362/f7Bw== @@ -5653,7 +6404,7 @@ rc-drawer@~1.8.0: prop-types "^15.5.0" rc-util "^4.5.1" -rc-dropdown@~2.4.1: +rc-dropdown@2.4.1, rc-dropdown@~2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-2.4.1.tgz#aaef6eb3a5152cdd9982895c2a78d9b5f046cdec" integrity sha512-p0XYn0wrOpAZ2fUGE6YJ6U8JBNc5ASijznZ6dkojdaEfQJAeZtV9KMEewhxkVlxGSbbdXe10ptjBlTEW9vEwEg== @@ -5725,6 +6476,22 @@ rc-input-number@~4.4.0: rc-util "^4.5.1" rmc-feedback "^2.0.0" +rc-menu@7.4.20: + version "7.4.20" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-7.4.20.tgz#5c322d330142c465d240d8da7d4206a2a329096c" + integrity sha512-ONhgwlfuoJTm09KeUq+J+rtAEPPN/tYo2RXQN3Sr/PKPPKw6+5ltP9RReHkPOWQEd3kypOcL0VpRJrk4B+M5Rg== + dependencies: + babel-runtime "6.x" + classnames "2.x" + dom-scroll-into-view "1.x" + mini-store "^2.0.0" + mutationobserver-shim "^0.3.2" + prop-types "^15.5.6" + rc-animate "2.x" + rc-trigger "^2.3.0" + rc-util "^4.1.0" + resize-observer-polyfill "^1.5.0" + rc-menu@^7.3.0: version "7.5.5" resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-7.5.5.tgz#78cdc817d86fc353a1430b864d3d96c7489600ca" @@ -5961,7 +6728,7 @@ rc-upload@~2.6.0: prop-types "^15.5.7" warning "4.x" -rc-util@^4.0.4, rc-util@^4.1.1, rc-util@^4.13.0, rc-util@^4.15.3, rc-util@^4.15.7, rc-util@^4.3.0, rc-util@^4.4.0, rc-util@^4.5.0, rc-util@^4.5.1: +rc-util@^4.0.4, rc-util@^4.1.0, rc-util@^4.1.1, rc-util@^4.13.0, rc-util@^4.15.3, rc-util@^4.15.7, rc-util@^4.3.0, rc-util@^4.4.0, rc-util@^4.5.0, rc-util@^4.5.1: version "4.19.0" resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-4.19.0.tgz#f3b5e3a02cc0a667d127784068e1236c095dbcbf" integrity sha512-mptALlLwpeczS3nrv83DbwJNeupolbuvlIEjcvimSiWI8NUBjpF0HgG3kWp1RymiuiRCNm9yhaXqDz0a99dpgQ== @@ -5977,7 +6744,20 @@ re-classnames@^4.0.0: resolved "https://registry.yarnpkg.com/re-classnames/-/re-classnames-4.1.0.tgz#a13e1d66d84518f55e78435579bc303f7dba55e1" integrity sha512-3gWpk6R5AP3H2r+k+6rcEygcrSJ6wRbvEpPcW55USHhSCMNdHMRs9iD02mZ3+urKQygys+AjZMQXrZ6HDBA2IQ== -react-dom@>=16.8.1, react-dom@^16.8.1: +react-apollo@^2.5.8: + version "2.5.8" + resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.5.8.tgz#c7a593b027efeefdd8399885e0ac6bec3b32623c" + integrity sha512-60yOQrnNosxU/tRbOxGDaYNLFcOKmQqxHPhxyvKTlGIaF/rRCXQRKixUgWVffpEupSHHD7psY5k5ZOuZsdsSGQ== + dependencies: + apollo-utilities "^1.3.0" + fast-json-stable-stringify "^2.0.0" + hoist-non-react-statics "^3.3.0" + lodash.isequal "^4.5.0" + prop-types "^15.7.2" + ts-invariant "^0.4.2" + tslib "^1.9.3" + +react-dom@16.12.0, react-dom@>=16.8.1, react-dom@^16.8.1: version "16.12.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11" integrity sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw== @@ -5987,6 +6767,19 @@ react-dom@>=16.8.1, react-dom@^16.8.1: prop-types "^15.6.2" scheduler "^0.18.0" +react-fast-compare@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9" + integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw== + +react-icons-kit@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/react-icons-kit/-/react-icons-kit-1.3.1.tgz#fbe56ce4379fc4391b4c6dfc1aa96e2b31e23623" + integrity sha512-9Xy81M+Vgt5DO9qAL0jIazNmjelcKWn+uNvChDAMYvawm4yaIecr5I8i/jDEEHgQcEqHpB848AitvRKKNAoljA== + dependencies: + camel-case "^3.0.0" + prop-types "^15.5.8" + react-is@^16.7.0, react-is@^16.8.1: version "16.12.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" @@ -6018,7 +6811,34 @@ react-slick@~0.24.0: lodash.debounce "^4.0.8" resize-observer-polyfill "^1.5.0" -react@>=16.8.1, react@^16.8.1: +react-textarea-autosize@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-7.1.2.tgz#70fdb333ef86bcca72717e25e623e90c336e2cda" + integrity sha512-uH3ORCsCa3C6LHxExExhF4jHoXYCQwE5oECmrRsunlspaDAbS4mGKNlWZqjLfInWtFQcf0o1n1jC/NGXFdUBCg== + dependencies: + "@babel/runtime" "^7.1.2" + prop-types "^15.6.0" + +react-use@13.19.0: + version "13.19.0" + resolved "https://registry.yarnpkg.com/react-use/-/react-use-13.19.0.tgz#00c7650012021e75b5cf9ea8c1b1b4e1c22eb076" + integrity sha512-By7d8ZhdWo0Ns2BW/Gla5EDrj9rTJ8p/ueJKv7SbqlDQvu9lpwovWGWKjY5Vjz5gAG3tZrSSxd1gK+gw7gZniQ== + dependencies: + "@types/js-cookie" "2.2.4" + "@xobotyi/scrollbar-width" "1.5.0" + copy-to-clipboard "^3.2.0" + fast-shallow-equal "^1.0.0" + js-cookie "^2.2.1" + nano-css "^5.2.1" + react-fast-compare "^2.0.4" + resize-observer-polyfill "^1.5.1" + screenfull "^5.0.0" + set-harmonic-interval "^1.0.1" + throttle-debounce "^2.1.0" + ts-easing "^0.2.0" + tslib "^1.10.0" + +react@16.12.0, react@>=16.8.1, react@^16.8.1: version "16.12.0" resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83" integrity sha512-fglqy3k5E+81pA8s+7K0/T3DBCF0ZDOher1elBFzF7O6arXJgzyu/FW+COxFvAWXJoJN9KIZbT2LXlukwphYTA== @@ -6072,6 +6892,25 @@ readdirp@~3.3.0: dependencies: picomatch "^2.0.7" +reason-apollo@0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/reason-apollo/-/reason-apollo-0.18.0.tgz#cc970da88de7ac603753eed68984c8492f0665c6" + integrity sha512-lw+IoIZ8qoX3iGOFFK//yMVC+Xmf+OcSyKkRgbBn0uG5GomLLMLiKRgjkhUsjAqJ4b3Se7H9JFnso5nL+GFEMA== + dependencies: + apollo-cache-inmemory "^1.6.0" + apollo-client "^2.6.3" + apollo-link "^1.2.12" + apollo-link-context "^1.0.18" + apollo-link-error "^1.1.11" + apollo-link-http "^1.5.15" + apollo-link-ws "^1.0.18" + apollo-upload-client "9.1.0" + apollo-utilities "^1.3.2" + graphql "^14.0.2" + graphql-tag "^2.10.0" + react-apollo "^2.5.8" + subscriptions-transport-ws "^0.9.16" + reason-react-compat@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/reason-react-compat/-/reason-react-compat-0.4.0.tgz#9c6705f9bd67e7ff7219355f3a95fd67442b578d" @@ -6082,7 +6921,7 @@ reason-react-update@^1.0.0: resolved "https://registry.yarnpkg.com/reason-react-update/-/reason-react-update-1.0.0.tgz#c2e9f064fb665e24d35073a93f901c5792fdf36f" integrity sha512-apsqywkgcEnkAc7V9fOs5ikEmufgYkxcLu5fqYWQ2Atb4UlYnoN7P92Xal3izReyqfk41G4zHlPHwJhoq0xwIA== -reason-react@>=0.7.0: +reason-react@0.7.0, reason-react@>=0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.7.0.tgz#46a975c321e81cd51310d7b1a02418ca7667b0d6" integrity sha512-czR/f0lY5iyLCki9gwftOFF5Zs40l7ZSFmpGK/Z6hx2jBVeFDmIiXB8bAQW/cO6IvtuEt97OmsYueiuOYG9XjQ== @@ -6267,12 +7106,17 @@ resolve-from@^3.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" integrity sha1-six699nWiBvItuZTM17rywoYh0g= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.5, resolve@^1.14.2, resolve@^1.3.2, resolve@^1.4.0: +resolve@^1.1.5, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.3.2, resolve@^1.4.0: version "1.15.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== @@ -6330,11 +7174,23 @@ rmc-feedback@^2.0.0: babel-runtime "6.x" classnames "^2.2.5" +rtl-css-js@^1.9.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/rtl-css-js/-/rtl-css-js-1.14.0.tgz#daa4f192a92509e292a0519f4b255e6e3c076b7d" + integrity sha512-Dl5xDTeN3e7scU1cWX8c9b6/Nqz3u/HgR4gePc1kWXYiQWVQbKCEyK6+Hxve9LbcJ5EieHy1J9nJCN3grTtGwg== + dependencies: + "@babel/runtime" "^7.1.2" + run-parallel@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== +rw@1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" + integrity sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q= + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" @@ -6384,6 +7240,11 @@ scheduler@^0.18.0: loose-envify "^1.1.0" object-assign "^4.1.1" +screenfull@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.0.2.tgz#b9acdcf1ec676a948674df5cd0ff66b902b0bed7" + integrity sha512-cCF2b+L/mnEiORLN5xSAz6H3t18i2oHh9BA8+CQlAh5DRw2+NFAGQJOSYbcGw8B2k04g/lVvFcfZ83b3ysH5UQ== + seed-random@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/seed-random/-/seed-random-2.2.0.tgz#2a9b19e250a817099231a5b99a4daf80b7fbed54" @@ -6451,6 +7312,11 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +set-harmonic-interval@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-harmonic-interval/-/set-harmonic-interval-1.0.1.tgz#e1773705539cdfb80ce1c3d99e7f298bb3995249" + integrity sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g== + set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" @@ -6589,16 +7455,26 @@ source-map-url@^0.4.0: resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= +source-map@0.5.6: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + integrity sha1-dc449SvwczxafwwRjYEzSiu19BI= + source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.5.0, source-map@^0.5.6: +source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= +sourcemap-codec@^1.4.1: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" @@ -6631,6 +7507,35 @@ stable@^0.1.8: resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== +stack-generator@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/stack-generator/-/stack-generator-2.0.5.tgz#fb00e5b4ee97de603e0773ea78ce944d81596c36" + integrity sha512-/t1ebrbHkrLrDuNMdeAcsvynWgoH/i4o8EGGfX7dEYDoTXOYVAkEpFdtshlvabzc6JlJ8Kf9YdFEoz7JkzGN9Q== + dependencies: + stackframe "^1.1.1" + +stackframe@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71" + integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ== + +stacktrace-gps@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/stacktrace-gps/-/stacktrace-gps-3.0.4.tgz#7688dc2fc09ffb3a13165ebe0dbcaf41bcf0c69a" + integrity sha512-qIr8x41yZVSldqdqe6jciXEaSCKw1U8XTXpjDuy0ki/apyTn/r3w9hDAAQOhZdxvsC93H+WwwEu5cq5VemzYeg== + dependencies: + source-map "0.5.6" + stackframe "^1.1.1" + +stacktrace-js@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/stacktrace-js/-/stacktrace-js-2.0.2.tgz#4ca93ea9f494752d55709a081d400fdaebee897b" + integrity sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg== + dependencies: + error-stack-parser "^2.0.6" + stack-generator "^2.0.5" + stacktrace-gps "^3.0.4" + static-eval@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/static-eval/-/static-eval-2.0.3.tgz#cb62fc79946bd4d5f623a45ad428233adace4d72" @@ -6802,6 +7707,22 @@ stylehacks@^4.0.0: postcss "^7.0.0" postcss-selector-parser "^3.0.0" +stylis@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.0.tgz#016fa239663d77f868fef5b67cf201c4b7c701e1" + integrity sha512-pP7yXN6dwMzAR29Q0mBrabPCe0/mNO1MSr93bhay+hcZondvMMTpeGyd8nbhYJdyperNT2DRxONQuUGcJr5iPw== + +subscriptions-transport-ws@^0.9.16: + version "0.9.16" + resolved "https://registry.yarnpkg.com/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.16.tgz#90a422f0771d9c32069294c08608af2d47f596ec" + integrity sha512-pQdoU7nC+EpStXnCfh/+ho0zE0Z+ma+i7xvj7bkXKb1dvYHSZxgRPaU6spRP+Bjzow67c/rRDoix5RT0uU9omw== + dependencies: + backo2 "^1.0.2" + eventemitter3 "^3.1.0" + iterall "^1.2.1" + symbol-observable "^1.0.4" + ws "^5.2.0" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -6854,6 +7775,11 @@ svgo@^1.0.0, svgo@^1.3.2: unquote "~1.1.1" util.promisify "~1.0.0" +symbol-observable@^1.0.2, symbol-observable@^1.0.4: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== + symbol-tree@^3.2.2: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -6899,6 +7825,11 @@ terser@^4.3.9: source-map "~0.6.1" source-map-support "~0.5.12" +throttle-debounce@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-2.1.0.tgz#257e648f0a56bd9e54fe0f132c4ab8611df4e1d5" + integrity sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg== + through2@^2.0.0, through2@~2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -7026,6 +7957,23 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= +ts-easing@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" + integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== + +ts-invariant@^0.4.0, ts-invariant@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.4.4.tgz#97a523518688f93aafad01b0e80eb803eb2abd86" + integrity sha512-uEtWkFM/sdZvRNNDL3Ehu4WVpwaulhwQszV8mrtcdeE8nN00BV9mAmQ88RkrBhFgl9gMgvjJLAQcZbnPXI9mlA== + dependencies: + tslib "^1.9.3" + +tslib@^1.10.0, tslib@^1.9.3: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -7164,6 +8112,11 @@ upath@^1.1.1: resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== +upper-case@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -7360,7 +8313,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@^5.1.1: +ws@^5.1.1, ws@^5.2.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== @@ -7399,6 +8352,13 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= +yaml@^1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.7.2.tgz#f26aabf738590ab61efaca502358e48dc9f348b2" + integrity sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw== + dependencies: + "@babel/runtime" "^7.6.3" + yargs-parser@^15.0.0: version "15.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.0.tgz#cdd7a97490ec836195f59f3f4dbe5ea9e8f75f08" @@ -7448,3 +8408,16 @@ yargs@^15.0.2: which-module "^2.0.0" y18n "^4.0.0" yargs-parser "^16.1.0" + +zen-observable-ts@^0.8.20: + version "0.8.20" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.20.tgz#44091e335d3fcbc97f6497e63e7f57d5b516b163" + integrity sha512-2rkjiPALhOtRaDX6pWyNqK1fnP5KkJJybYebopNSn6wDG1lxBoFs2+nwwXKoA6glHIrtwrfBBy6da0stkKtTAA== + dependencies: + tslib "^1.9.3" + zen-observable "^0.8.0" + +zen-observable@^0.8.0: + version "0.8.15" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" + integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== From 088a623bef7e2355d4bbfd5da8d8d2fdafdbb3eb Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 12:40:04 +0000 Subject: [PATCH 03/28] Use lognormal instead of normal --- src/lib/FloatCdf.re | 10 ++++++++++ src/lib/Prop.re | 7 ++----- src/models/EAFunds.re | 5 ++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/lib/FloatCdf.re b/src/lib/FloatCdf.re index d94c209b..f13e112b 100644 --- a/src/lib/FloatCdf.re +++ b/src/lib/FloatCdf.re @@ -7,4 +7,14 @@ let normal = (mean: float, std: float) => } ); +let logNormal = (mean: float, std: float) => { + Js.Float.( + { + let nMean = toPrecisionWithPrecision(Js.Math.log10(mean), ~digits=4); + let nStd = toPrecisionWithPrecision(std, ~digits=2); + {j|lognormal($(nMean), $(nStd))|j}; + } + ); +}; + let divide = (str1: string, str2: string) => {j|$(str1)/$(str2)|j}; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index ddcae4ff..57a77e54 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -18,10 +18,7 @@ module Value = { | Unselected => "" } | SelectSingle(r) => r - | FloatCdf(r) => - let foo: Types.distribution = - CdfLibrary.Distribution.fromString(r, 100); - r; + | FloatCdf(r) => r | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed @@ -41,7 +38,7 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | FloatCdf(r) => let cdf: Types.distribution = - CdfLibrary.Distribution.fromString(r, 100); + CdfLibrary.Distribution.fromString(r, 1000); <> { From 089dfeeef24f7096fd50d8565350f9d1e9d3f472 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 17:48:47 +0000 Subject: [PATCH 04/28] LimitedDomainCdf file --- src/LimitedDomainCdf.re | 33 +++++++++++++++++++++++++++++++++ src/lib/Prop.re | 2 +- src/lib/Types.re | 10 +++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 src/LimitedDomainCdf.re diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re new file mode 100644 index 00000000..7a33db45 --- /dev/null +++ b/src/LimitedDomainCdf.re @@ -0,0 +1,33 @@ +type t = { + distribution: Types.distribution, + domainMaxX: float, +}; + +let fromCdf = (cdf: Types.cdf, domainMaxX: float, probabilityAtMaxX: float) => { + let distribution: Types.distribution = { + xs: cdf.xs, + ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), + }; + {distribution, domainMaxX}; +}; + +let _lastElement = (a: array('a)) => + switch (Belt.Array.size(a)) { + | 0 => None + | n => Belt.Array.get(a, n) + }; + +let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); + +let chanceByX = (t: t) => t.distribution; + +let domainMaxX = (t: t) => t.domainMaxX; + +let probabilityDistribution = (t: t) => + t.distribution |> CdfLibrary.Distribution.toPdf; + +let probability = (t: t, xPoint: float) => + CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); + +let cumulativeProbability = (t: t, xPoint: float) => + CdfLibrary.Distribution.findY(xPoint, t.distribution); \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 57a77e54..bc238c6b 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -38,7 +38,7 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | FloatCdf(r) => let cdf: Types.distribution = - CdfLibrary.Distribution.fromString(r, 1000); + CdfLibrary.Distribution.fromString(r, 2000); <> { xs: d.xs, ys: d.ys, -}; \ No newline at end of file +}; + +type pdf = distribution; +type cdf = distribution; + +let foo = (b: pdf) => 3.9; +let bar: cdf = {xs: [||], ys: [||]}; + +let cc = foo(bar); \ No newline at end of file From b85f2c8729d220a33005e6a40b162199005301b4 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 18:28:34 +0000 Subject: [PATCH 05/28] Minor cleanup --- src/lib/Chart.re | 20 +++++++++++++++ src/lib/Prop.re | 5 +--- src/lib/Types.re | 39 +++++++++++++++++++++++++++++- src/utility/GuesstimatorLibrary.js | 1 - 4 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 src/lib/Chart.re diff --git a/src/lib/Chart.re b/src/lib/Chart.re new file mode 100644 index 00000000..439928e7 --- /dev/null +++ b/src/lib/Chart.re @@ -0,0 +1,20 @@ +[@react.component] +let make = + ( + ~data, + ~minX=None, + ~maxX=None, + ~width=300, + ~height=50, + ~color=`hex("7e9db7"), + ) => + ; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index bc238c6b..21c5f922 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -40,10 +40,7 @@ module Value = { let cdf: Types.distribution = CdfLibrary.Distribution.fromString(r, 2000); <> - + CdfLibrary.Distribution.toPdf |> Types.toJs} /> {r |> ReasonReact.string} ; | Probability(r) => diff --git a/src/lib/Types.re b/src/lib/Types.re index ea323b11..fb7ace63 100644 --- a/src/lib/Types.re +++ b/src/lib/Types.re @@ -3,6 +3,10 @@ type distribution = { ys: array(float), }; +let toJs = (t: distribution) => { + {"xs": t.xs, "ys": t.ys}; +}; + let toComponentsDist = (d: distribution): ForetoldComponents.Types.Dist.t => { xs: d.xs, ys: d.ys, @@ -14,4 +18,37 @@ type cdf = distribution; let foo = (b: pdf) => 3.9; let bar: cdf = {xs: [||], ys: [||]}; -let cc = foo(bar); \ No newline at end of file +let cc = foo(bar); + +module LimitedDomainCdf = { + type t = { + distribution, + domainMaxX: float, + }; + + let fromCdf = (cdf: cdf, domainMaxX: float, probabilityAtMaxX: float) => { + let distribution: distribution = { + xs: cdf.xs, + ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), + }; + {distribution, domainMaxX}; + }; + + let _lastElement = (a: array('a)) => + switch (Belt.Array.size(a)) { + | 0 => None + | n => Belt.Array.get(a, n) + }; + + let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); + + let chanceByX = (t: t) => t.distribution; + + let domainMaxX = (t: t) => t.domainMaxX; + // let probabilityDistribution = (t: t) => + // t.distribution |> CdfLibrary.Distribution.toPdf; + // let probability = (t: t, xPoint: float) => + // CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); + // let cumulativeProbability = (t: t, xPoint: float) => + // CdfLibrary.Distribution.findY(xPoint, t.distribution); +}; \ No newline at end of file diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js index 55f12894..345ceb77 100644 --- a/src/utility/GuesstimatorLibrary.js +++ b/src/utility/GuesstimatorLibrary.js @@ -44,7 +44,6 @@ const toPdf = (values, sampleCount, min, max) => { }; let run = (text, sampleCount, inputs=[], min=false, max=false) => { - console.log(text); let [_error, item] = Guesstimator.parse({ text: "=" + text }); const { parsedInput } = item; const { guesstimateType } = parsedInput; From dfbdc51085767296ecbb1f0a86f6bbe7276b99d8 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 18:35:10 +0000 Subject: [PATCH 06/28] Added bs-css, styld Chart.re --- bsconfig.json | 1 + package.json | 1 + src/lib/Chart.re | 34 ++++++++++++++++++++++++---------- src/lib/Prop.re | 5 ++++- yarn.lock | 2 +- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/bsconfig.json b/bsconfig.json index be57d770..359646a4 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -19,6 +19,7 @@ "bs-ant-design-alt", "reason-react", "bs-reform", + "bs-css", "rationale", "bs-moment", "reschema" diff --git a/package.json b/package.json index f6424815..90305344 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "antd": "3.17.0", "autoprefixer": "^9.7.4", "bs-ant-design-alt": "2.0.0-alpha.31", + "bs-css": "^11.0.0", "bs-moment": "0.4.4", "bs-reform": "9.7.1", "lenses-ppx": "4.0.0", diff --git a/src/lib/Chart.re b/src/lib/Chart.re index 439928e7..9002108b 100644 --- a/src/lib/Chart.re +++ b/src/lib/Chart.re @@ -1,3 +1,15 @@ +module Styles = { + open Css; + let graph = chartColor => + style([ + selector(".axis", [fontSize(`px(9))]), + selector(".domain", [display(`none)]), + selector(".tick line", [display(`none)]), + selector(".tick text", [color(`hex("bfcad4"))]), + selector(".chart .area-path", [SVG.fill(chartColor)]), + ]); +}; + [@react.component] let make = ( @@ -8,13 +20,15 @@ let make = ~height=50, ~color=`hex("7e9db7"), ) => - ; \ No newline at end of file +
+ +
; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 21c5f922..8297864e 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -40,7 +40,10 @@ module Value = { let cdf: Types.distribution = CdfLibrary.Distribution.fromString(r, 2000); <> - CdfLibrary.Distribution.toPdf |> Types.toJs} /> + CdfLibrary.Distribution.toPdf |> Types.toJs} + /> {r |> ReasonReact.string} ; | Probability(r) => diff --git a/yarn.lock b/yarn.lock index 1fb67dcc..fa7acb48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1955,7 +1955,7 @@ bs-ant-design-alt@2.0.0-alpha.31: bs-moment "^0.4.4" re-classnames "^4.0.0" -bs-css@11.0.0: +bs-css@11.0.0, bs-css@^11.0.0: version "11.0.0" resolved "https://registry.yarnpkg.com/bs-css/-/bs-css-11.0.0.tgz#6ed1726d7c06aa584d255d1cf23240a2acc0aa07" integrity sha512-bpSwj1VvmWNMoJ5qnsHMQC+Mj0zjL9iwcOhl5ipP7Hfr7v+ZyKqjSMaMK+L1EdukuCp0rJmRD2I/MbS4BHnMmQ== From 2f503fbef618948bb04b379bb2bf81ac89c5b915 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 18:56:14 +0000 Subject: [PATCH 07/28] First prototype of conditionals --- src/lib/Prop.re | 22 ++++++++++++++++++++++ src/lib/ValueForm.re | 1 + src/models/EAFunds.re | 17 +++++++++-------- src/models/GlobalCatastrophe.re | 5 +++++ 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 8297864e..e55aefda 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -2,12 +2,20 @@ module Value = { type binaryConditional = | Selected(bool) | Unselected; + + type conditional = { + statement: string, + truthValue: bool, + }; + type t = | BinaryConditional(binaryConditional) | SelectSingle(string) | DateTime(MomentRe.Moment.t) | FloatPoint(float) | Probability(float) + | Conditional(conditional) + | ConditionalArray(array(conditional)) | FloatCdf(string); let to_string = (t: t) => { @@ -36,6 +44,8 @@ module Value = { ) |> ReasonReact.string | SelectSingle(r) => r |> ReasonReact.string + | ConditionalArray(r) => "Array" |> ReasonReact.string + | Conditional(r) => r.statement |> ReasonReact.string | FloatCdf(r) => let cdf: Types.distribution = CdfLibrary.Distribution.fromString(r, 2000); @@ -65,6 +75,16 @@ module Type = { default: option(string), }; + type conditionals = { + defaults: array(Value.conditional), + options: array(string), + }; + + let makeConditionals = (defaults, options): conditionals => { + defaults, + options, + }; + type floatPoint = {validatations: list(float => bool)}; type withDefaultMinMax('a) = { @@ -82,11 +102,13 @@ module Type = { | Probability(withDefault(float)) | DateTime(withDefaultMinMax(MomentRe.Moment.t)) | Year(withDefaultMinMax(float)) + | Conditionals(conditionals) | FloatCdf; let default = (t: t) => switch (t) { | BinaryConditional => Some(Value.BinaryConditional(Unselected)) + | Conditionals(s) => Some(Value.ConditionalArray(s.defaults)) | Year(r) => r.default->Belt.Option.map(p => Value.FloatPoint(p)) | FloatPoint(r) => r.default->Belt.Option.map(p => Value.FloatPoint(p)) | Probability(r) => r.default->Belt.Option.map(p => Value.Probability(p)) diff --git a/src/lib/ValueForm.re b/src/lib/ValueForm.re index 89a0e812..ceaf9d00 100644 --- a/src/lib/ValueForm.re +++ b/src/lib/ValueForm.re @@ -11,6 +11,7 @@ let make = ~onChange: onChange, ) => { switch (type_.type_, value) { + | (Conditionals(_), r) => "sdfsdf" |> ReasonReact.string | (Year(_), Some(FloatPoint(r))) => choiceFromString(fund) |> E.O.fmap(fund => @@ -230,14 +229,16 @@ module Interface = { }), (), ), - TypeWithMetadata.make( - ~name="Conditional on World Ending", - ~id="worldEnd", - ~type_=BinaryConditional, - (), - ), |], outputTypes: [||], run, }; -}; \ No newline at end of file +} /* )*/; +// TypeWithMetadata.make( +// ~name="Conditional on World Ending", +// ~id="worldEnd", +// ~type_= +// Conditionals( +// Prop.Type.makeConditionals([||], [|"Foo", "Bar", "Char"|]), +// ), +// (), \ No newline at end of file diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 6c843644..7487959d 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,4 +1,9 @@ module Model = { + let foo = { + let bar = 2.0; + (); + }; + let make = (dateTime: MomentRe.Moment.t, currentDateTime: MomentRe.Moment.t) => { let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; Prop.Value.Probability(0.001 *. yearDiff); From b06ac56efdb34174996a261fada0ea74fa61cfef Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Thu, 13 Feb 2020 21:24:47 +0000 Subject: [PATCH 08/28] Simple buttons on conditionals --- src/lib/E.re | 1 + src/lib/Prop.re | 4 +- src/lib/ValueForm.re | 95 ++++++++++++++++++++++++++++++++++++++++++- src/models/EAFunds.re | 19 +++++---- 4 files changed, 107 insertions(+), 12 deletions(-) diff --git a/src/lib/E.re b/src/lib/E.re index 177f4a85..298cb21e 100644 --- a/src/lib/E.re +++ b/src/lib/E.re @@ -211,6 +211,7 @@ module A = { let unsafe_get = Array.unsafe_get; let get = Belt.Array.get; let getBy = Belt.Array.getBy; + let hasBy = (r, fn) => Belt.Array.getBy(r, fn) |> O.isSome; let fold_left = Array.fold_left; let fold_right = Array.fold_right; let concatMany = Belt.Array.concatMany; diff --git a/src/lib/Prop.re b/src/lib/Prop.re index e55aefda..9d240aee 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -4,7 +4,7 @@ module Value = { | Unselected; type conditional = { - statement: string, + name: string, truthValue: bool, }; @@ -45,7 +45,7 @@ module Value = { |> ReasonReact.string | SelectSingle(r) => r |> ReasonReact.string | ConditionalArray(r) => "Array" |> ReasonReact.string - | Conditional(r) => r.statement |> ReasonReact.string + | Conditional(r) => r.name |> ReasonReact.string | FloatCdf(r) => let cdf: Types.distribution = CdfLibrary.Distribution.fromString(r, 2000); diff --git a/src/lib/ValueForm.re b/src/lib/ValueForm.re index ceaf9d00..ab73f1d3 100644 --- a/src/lib/ValueForm.re +++ b/src/lib/ValueForm.re @@ -3,6 +3,26 @@ let handleChange = (handleChange, event) => handleChange(ReactEvent.Form.target(event)##value); type onChange = option(Value.t) => unit; +module ConditionalReducer = { + type action = + | ADD_OR_UPDATE_CONDITIONAL(Value.conditional) + | REMOVE_CONDITIONAL(Value.conditional); + + let reducer = (items: array(Value.conditional), action: action) => + switch (action) { + | ADD_OR_UPDATE_CONDITIONAL(conditional) => + items->E.A.hasBy(c => c.name == conditional.name) + ? items + |> E.A.fmap((r: Value.conditional) => + r.name == conditional.name ? conditional : r + ) + : E.A.append(items, [|conditional|]) + | REMOVE_CONDITIONAL(conditional) => + items + |> E.A.filter((c: Value.conditional) => c.name != conditional.name) + }; +}; + [@react.component] let make = ( @@ -11,7 +31,80 @@ let make = ~onChange: onChange, ) => { switch (type_.type_, value) { - | (Conditionals(_), r) => "sdfsdf" |> ReasonReact.string + | (Conditionals(l), Some(ConditionalArray(n))) => +
+ {n + |> E.A.fmap((r: Value.conditional) => +
+ onChange( + Some( + Value.ConditionalArray( + ConditionalReducer.reducer( + n, + REMOVE_CONDITIONAL({name: r.name, truthValue: true}), + ), + ), + ), + ) + }> + {r.name |> ReasonReact.string} + {(r.truthValue ? "TRUE" : "FALSE") |> ReasonReact.string} +
+ ) + |> ReasonReact.array} + {l.options + |> E.A.fmap(r => +
+ {r |> ReasonReact.string} + + +
+ ) + |> ReasonReact.array} +
+ | (Conditionals(l), _) => + l.options |> E.A.fmap(r => r |> ReasonReact.string) |> ReasonReact.array | (Year(_), Some(FloatPoint(r))) => Date: Thu, 13 Feb 2020 22:04:13 +0000 Subject: [PATCH 09/28] Minor cleanup --- src/index.html | 2 +- src/lib/Prop.re | 3 +++ src/lib/ValueForm.re | 8 ++++---- src/models/EAFunds.re | 10 +++++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/index.html b/src/index.html index c157a5aa..80546e46 100644 --- a/src/index.html +++ b/src/index.html @@ -3,7 +3,7 @@ - Foretold.io + Estiband diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 9d240aee..9e0929f4 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -30,6 +30,9 @@ module Value = { | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed + | Conditional(r) => r.name + | ConditionalArray(r) => + r |> E.A.fmap(r => r.name) |> Js.Array.joinWith(",") }; }; diff --git a/src/lib/ValueForm.re b/src/lib/ValueForm.re index ab73f1d3..11f19015 100644 --- a/src/lib/ValueForm.re +++ b/src/lib/ValueForm.re @@ -59,7 +59,7 @@ let make = className="max-w-sm rounded overflow-hidden shadow-sm py-1 px-2 rounded mb-3 bg-gray-200"> {r |> ReasonReact.string} ) diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index f256a758..6d6f03b9 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -152,6 +152,7 @@ module Interface = { Some(DateTime(intendedYear)), Some(DateTime(currentYear)), Some(SelectSingle(output)), + _, |] => choiceFromString(fund) |> E.O.fmap(fund => @@ -230,11 +231,14 @@ module Interface = { (), ), TypeWithMetadata.make( - ~name="Conditional on World Ending", - ~id="worldEnd", + ~name="Conditionals", + ~id="conditionals", ~type_= Conditionals( - Prop.Type.makeConditionals([||], [|"Foo", "Bar", "Char"|]), + Prop.Type.makeConditionals( + [||], + [|"Global Existential Event"|], + ), ), (), ), From 5970f46c06e3b8a6c4ca8831bd54a70c268395d2 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Fri, 14 Feb 2020 12:08:19 +0000 Subject: [PATCH 10/28] Initial work on time domain --- .gitignore | 4 +- src/LimitedDomainCdf.re | 10 +++-- src/TimeLimitedDomainCdf.re | 74 +++++++++++++++++++++++++++++++++ src/models/GlobalCatastrophe.re | 5 --- 4 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 src/TimeLimitedDomainCdf.re diff --git a/.gitignore b/.gitignore index 9b548cc4..72fa0d42 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ lib/* *.cache build yarn-error.log -*.bs.js \ No newline at end of file +*.bs.js +# Local Netlify folder +.netlify \ No newline at end of file diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re index 7a33db45..fad1d421 100644 --- a/src/LimitedDomainCdf.re +++ b/src/LimitedDomainCdf.re @@ -19,8 +19,6 @@ let _lastElement = (a: array('a)) => let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); -let chanceByX = (t: t) => t.distribution; - let domainMaxX = (t: t) => t.domainMaxX; let probabilityDistribution = (t: t) => @@ -29,5 +27,11 @@ let probabilityDistribution = (t: t) => let probability = (t: t, xPoint: float) => CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); +let probabilityInverse = (t: t, yPoint: float) => + CdfLibrary.Distribution.findX(yPoint, probabilityDistribution(t)); + let cumulativeProbability = (t: t, xPoint: float) => - CdfLibrary.Distribution.findY(xPoint, t.distribution); \ No newline at end of file + CdfLibrary.Distribution.findY(xPoint, t.distribution); + +let cumulativeProbabilityInverse = (t: t, yPoint: float) => + CdfLibrary.Distribution.findX(yPoint, t.distribution); \ No newline at end of file diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re new file mode 100644 index 00000000..152497a9 --- /dev/null +++ b/src/TimeLimitedDomainCdf.re @@ -0,0 +1,74 @@ +type timeUnit = [ + | `days + | `hours + | `milliseconds + | `minutes + | `months + | `quarters + | `seconds + | `weeks + | `years +]; + +type t = { + timeUnit, + timeStart: MomentRe.Moment.t, + limitedDomainCdf: LimitedDomainCdf.t, +}; + +module XSpecification = { + type xSpecification = + | Time(MomentRe.Moment.t) + | DifferenceFromStart(float, timeUnit) + | CdfXCoordinate(float); + + let toTime = (t: t, xSpecification: xSpecification) => + switch (xSpecification) { + | Time(r) => r + | DifferenceFromStart(r, unit) => + t.timeStart + |> MomentRe.Moment.add(~duration=MomentRe.duration(r, unit)) + | CdfXCoordinate(r) => + t.timeStart + |> MomentRe.Moment.add(~duration=MomentRe.duration(r, t.timeUnit)) + }; + + let rec toCdfXCoordinate = (t: t, xSpecification: xSpecification) => + switch (xSpecification) { + | Time(r) => MomentRe.diff(t.timeStart, r, t.timeUnit) + | DifferenceFromStart(r, unit) => + let newTime = toTime(t, DifferenceFromStart(r, unit)); + toCdfXCoordinate(t, Time(newTime)); + | CdfXCoordinate(r) => r + }; + + let fromDifference = (~t: t, ~duration: float, ~unit=t.timeUnit, ()) => + Time( + MomentRe.Moment.add( + ~duration=MomentRe.duration(duration, unit), + t.timeStart, + ), + ); +}; + +let probabilityBeforeDomainMax = (t: t) => + LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); + +let domainMaxX = (t: t) => + LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); + +let probability = (t: t, x: XSpecification.xSpecification) => + LimitedDomainCdf.probability( + t.limitedDomainCdf, + XSpecification.toCdfXCoordinate(t, x), + ); + +let probabilityInverse = (t: t, y: float) => + XSpecification.CdfXCoordinate( + LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y), + ); + +let cumulativeProbabilityInverse = (t: t, y: float) => + XSpecification.CdfXCoordinate( + LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y), + ); \ No newline at end of file diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 7487959d..6c843644 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,9 +1,4 @@ module Model = { - let foo = { - let bar = 2.0; - (); - }; - let make = (dateTime: MomentRe.Moment.t, currentDateTime: MomentRe.Moment.t) => { let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; Prop.Value.Probability(0.001 *. yearDiff); From 320ed0d47735018ed15bb309117723693f051e3d Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Fri, 14 Feb 2020 21:53:47 +0000 Subject: [PATCH 11/28] Show graph of TimeLimitedDomainCdf --- src/LimitedDomainCdf.re | 2 + src/TimeLimitedDomainCdf.re | 121 ++++++++++++++++++++------------ src/lib/Prop.re | 5 ++ src/models/GlobalCatastrophe.re | 49 ++++--------- 4 files changed, 96 insertions(+), 81 deletions(-) diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re index fad1d421..9cf7d18f 100644 --- a/src/LimitedDomainCdf.re +++ b/src/LimitedDomainCdf.re @@ -3,6 +3,8 @@ type t = { domainMaxX: float, }; +let make = (~distribution, ~domainMaxX): t => {distribution, domainMaxX}; + let fromCdf = (cdf: Types.cdf, domainMaxX: float, probabilityAtMaxX: float) => { let distribution: Types.distribution = { xs: cdf.xs, diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re index 152497a9..78aee494 100644 --- a/src/TimeLimitedDomainCdf.re +++ b/src/TimeLimitedDomainCdf.re @@ -10,45 +10,75 @@ type timeUnit = [ | `years ]; +type timeVector = { + zero: MomentRe.Moment.t, + unit: timeUnit, +}; + +type timePoint = { + timeVector, + value: float, +}; + +module TimePoint = { + let fromTimeVector = (timeVector, value): timePoint => {timeVector, value}; + + let toMoment = (timePoint: timePoint) => { + timePoint.timeVector.zero + |> MomentRe.Moment.add( + ~duration= + MomentRe.duration(timePoint.value, timePoint.timeVector.unit), + ); + }; + + let fromMoment = (timeVector: timeVector, moment: MomentRe.Moment.t) => + MomentRe.diff(timeVector.zero, moment, timeVector.unit); +}; + +module RelativeTimePoint = { + type timeInVector = + | Time(MomentRe.Moment.t) + | XValue(float); + + let toTime = (timeVector: timeVector, timeInVector: timeInVector) => + switch (timeInVector) { + | Time(r) => r + | XValue(r) => + timeVector.zero + |> MomentRe.Moment.add(~duration=MomentRe.duration(r, timeVector.unit)) + }; + + let _timeToX = (time, timeStart, timeUnit) => + MomentRe.diff(timeStart, time, timeUnit); + + let toXValue = (timeVector: timeVector, timeInVector: timeInVector) => + switch (timeInVector) { + | Time(r) => _timeToX(r, timeVector.zero, timeVector.unit) + | XValue(r) => r + }; +}; + type t = { - timeUnit, - timeStart: MomentRe.Moment.t, + timeVector, limitedDomainCdf: LimitedDomainCdf.t, }; -module XSpecification = { - type xSpecification = - | Time(MomentRe.Moment.t) - | DifferenceFromStart(float, timeUnit) - | CdfXCoordinate(float); - - let toTime = (t: t, xSpecification: xSpecification) => - switch (xSpecification) { - | Time(r) => r - | DifferenceFromStart(r, unit) => - t.timeStart - |> MomentRe.Moment.add(~duration=MomentRe.duration(r, unit)) - | CdfXCoordinate(r) => - t.timeStart - |> MomentRe.Moment.add(~duration=MomentRe.duration(r, t.timeUnit)) +let make = + ( + ~timeVector: timeVector, + ~distribution: Types.distribution, + ~probabilityAtMaxX: float, + ~maxX: [ | `time(MomentRe.Moment.t) | `x(float)], + ) + : t => { + let domainMaxX = + switch (maxX) { + | `time(m) => TimePoint.fromMoment(timeVector, m) + | `x(r) => r }; - - let rec toCdfXCoordinate = (t: t, xSpecification: xSpecification) => - switch (xSpecification) { - | Time(r) => MomentRe.diff(t.timeStart, r, t.timeUnit) - | DifferenceFromStart(r, unit) => - let newTime = toTime(t, DifferenceFromStart(r, unit)); - toCdfXCoordinate(t, Time(newTime)); - | CdfXCoordinate(r) => r - }; - - let fromDifference = (~t: t, ~duration: float, ~unit=t.timeUnit, ()) => - Time( - MomentRe.Moment.add( - ~duration=MomentRe.duration(duration, unit), - t.timeStart, - ), - ); + let limitedDomainCdf = + LimitedDomainCdf.fromCdf(distribution, domainMaxX, probabilityAtMaxX); + {timeVector, limitedDomainCdf}; }; let probabilityBeforeDomainMax = (t: t) => @@ -57,18 +87,19 @@ let probabilityBeforeDomainMax = (t: t) => let domainMaxX = (t: t) => LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); -let probability = (t: t, x: XSpecification.xSpecification) => - LimitedDomainCdf.probability( - t.limitedDomainCdf, - XSpecification.toCdfXCoordinate(t, x), - ); +let probability = (t: t, m: MomentRe.Moment.t) => { + RelativeTimePoint.toXValue(t.timeVector, Time(m)) + |> LimitedDomainCdf.probability(t.limitedDomainCdf); +}; let probabilityInverse = (t: t, y: float) => - XSpecification.CdfXCoordinate( - LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y), - ); + LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y) + |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); + +let cumulativeProbability = (t: t, m: MomentRe.Moment.t) => + RelativeTimePoint.toXValue(t.timeVector, Time(m)) + |> LimitedDomainCdf.cumulativeProbability(t.limitedDomainCdf); let cumulativeProbabilityInverse = (t: t, y: float) => - XSpecification.CdfXCoordinate( - LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y), - ); \ No newline at end of file + LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y) + |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 9e0929f4..187511e0 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -15,6 +15,7 @@ module Value = { | FloatPoint(float) | Probability(float) | Conditional(conditional) + | TimeLimitedDomainCdf(TimeLimitedDomainCdf.t) | ConditionalArray(array(conditional)) | FloatCdf(string); @@ -27,6 +28,7 @@ module Value = { } | SelectSingle(r) => r | FloatCdf(r) => r + | TimeLimitedDomainCdf(_) => "" | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed @@ -49,6 +51,9 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | ConditionalArray(r) => "Array" |> ReasonReact.string | Conditional(r) => r.name |> ReasonReact.string + | TimeLimitedDomainCdf(r) => + let cdf: Types.distribution = r.limitedDomainCdf.distribution; + <> Types.toJs} /> ; | FloatCdf(r) => let cdf: Types.distribution = CdfLibrary.Distribution.fromString(r, 2000); diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 6c843644..7d901424 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,7 +1,15 @@ module Model = { - let make = (dateTime: MomentRe.Moment.t, currentDateTime: MomentRe.Moment.t) => { - let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; - Prop.Value.Probability(0.001 *. yearDiff); + let make = (currentDateTime: MomentRe.Moment.t) => { + let yearsFromNow = "normal(50,30)"; + let dist = CdfLibrary.Distribution.fromString(yearsFromNow, 1000); + let timeLimitedDomain = + TimeLimitedDomainCdf.make( + ~timeVector={zero: currentDateTime, unit: `years}, + ~distribution=dist, + ~probabilityAtMaxX=0.7, + ~maxX=`x(200.), + ); + Prop.Value.TimeLimitedDomainCdf(timeLimitedDomain); }; }; @@ -10,8 +18,7 @@ module Interface = { let run = (p: Prop.Combo.t) => { switch (Prop.Combo.InputValues.toValueArray(p)) { - | [|Some(DateTime(intendedYear)), Some(DateTime(currentYear))|] => - Some(Model.make(intendedYear, currentYear)) + | [|Some(DateTime(currentYear))|] => Some(Model.make(currentYear)) | _ => None }; }; @@ -22,37 +29,7 @@ module Interface = { description: "The chances of having at least one catastrophe per year in the future, assuming no other catastrophe until then.", version: "1.0.0", author: "Ozzie Gooen", - inputTypes: [| - TypeWithMetadata.make( - ~name=dayKey, - ~type_= - DateTime({ - default: - Some( - MomentRe.Moment.add( - ~duration=MomentRe.duration(5., `years), - MomentRe.momentNow(), - ), - ), - min: - Some( - MomentRe.Moment.subtract( - ~duration=MomentRe.duration(20., `years), - MomentRe.momentNow(), - ), - ), - max: - Some( - MomentRe.Moment.add( - ~duration=MomentRe.duration(20., `years), - MomentRe.momentNow(), - ), - ), - }), - (), - ), - TypeWithMetadata.currentYear, - |], + inputTypes: [|TypeWithMetadata.currentYear|], outputTypes: [||], run, }; From 4eb424784864cbf32817b86b3374e27fd9c40a1f Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Fri, 14 Feb 2020 22:29:22 +0000 Subject: [PATCH 12/28] Simple lazy cdfs --- src/lib/Prop.re | 8 ++++++++ src/models/GlobalCatastrophe.re | 8 +++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 187511e0..14131b60 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -16,6 +16,9 @@ module Value = { | Probability(float) | Conditional(conditional) | TimeLimitedDomainCdf(TimeLimitedDomainCdf.t) + | TimeLimitedDomainCdfLazy( + (string => Types.distribution) => TimeLimitedDomainCdf.t, + ) | ConditionalArray(array(conditional)) | FloatCdf(string); @@ -29,6 +32,7 @@ module Value = { | SelectSingle(r) => r | FloatCdf(r) => r | TimeLimitedDomainCdf(_) => "" + | TimeLimitedDomainCdfLazy(_) => "" | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed @@ -51,6 +55,10 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | ConditionalArray(r) => "Array" |> ReasonReact.string | Conditional(r) => r.name |> ReasonReact.string + | TimeLimitedDomainCdfLazy(r) => + let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); + let cdf = timeLimited.limitedDomainCdf.distribution; + <> Types.toJs} /> ; | TimeLimitedDomainCdf(r) => let cdf: Types.distribution = r.limitedDomainCdf.distribution; <> Types.toJs} /> ; diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 7d901424..5de10984 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,15 +1,13 @@ module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { - let yearsFromNow = "normal(50,30)"; - let dist = CdfLibrary.Distribution.fromString(yearsFromNow, 1000); - let timeLimitedDomain = + let lazyDistribution = r => TimeLimitedDomainCdf.make( ~timeVector={zero: currentDateTime, unit: `years}, - ~distribution=dist, + ~distribution=r("normal(50,30)"), ~probabilityAtMaxX=0.7, ~maxX=`x(200.), ); - Prop.Value.TimeLimitedDomainCdf(timeLimitedDomain); + Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution); }; }; From 5bd66be29eefa943380d4b258f8b27c67ea88bfe Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 11:39:37 +0000 Subject: [PATCH 13/28] Minor changes --- src/lib/FloatCdf.re | 2 +- src/lib/Prop.re | 9 ++++++++- src/models/EAFunds.re | 10 ++++++++-- src/models/GlobalCatastrophe.re | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/lib/FloatCdf.re b/src/lib/FloatCdf.re index f13e112b..dea45fb4 100644 --- a/src/lib/FloatCdf.re +++ b/src/lib/FloatCdf.re @@ -11,7 +11,7 @@ let logNormal = (mean: float, std: float) => { Js.Float.( { let nMean = toPrecisionWithPrecision(Js.Math.log10(mean), ~digits=4); - let nStd = toPrecisionWithPrecision(std, ~digits=2); + let nStd = toPrecisionWithPrecision(Js.Math.log10(std), ~digits=2); {j|lognormal($(nMean), $(nStd))|j}; } ); diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 14131b60..1eba0bd3 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -58,7 +58,14 @@ module Value = { | TimeLimitedDomainCdfLazy(r) => let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); let cdf = timeLimited.limitedDomainCdf.distribution; - <> Types.toJs} /> ; + <> + Types.toJs} /> + CdfLibrary.Distribution.toPdf |> Types.toJs} + /> + {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} + ; | TimeLimitedDomainCdf(r) => let cdf: Types.distribution = r.limitedDomainCdf.distribution; <> Types.toJs} /> ; diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 6d6f03b9..9a43ca98 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -122,8 +122,14 @@ module Model = { ), ) | CHANCE_OF_EXISTENCE => - let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; - Prop.Value.Probability((100. -. yearDiff) /. 100.); + let lazyDistribution = r => + TimeLimitedDomainCdf.make( + ~timeVector={zero: currentDateTime, unit: `years}, + ~distribution=r(FloatCdf.logNormal(10., 2.)), + ~probabilityAtMaxX=0.7, + ~maxX=`x(200.), + ); + Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution); }; }; }; diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 5de10984..ddd9c196 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -3,7 +3,7 @@ module Model = { let lazyDistribution = r => TimeLimitedDomainCdf.make( ~timeVector={zero: currentDateTime, unit: `years}, - ~distribution=r("normal(50,30)"), + ~distribution=r(FloatCdf.logNormal(20., 3.)), ~probabilityAtMaxX=0.7, ~maxX=`x(200.), ); From ab9c8726d69196f63f0c939167b14aca48ee5e79 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 16:29:23 +0000 Subject: [PATCH 14/28] Simple mixed distribution --- src/LimitedDomainCdf.re | 11 +++-- src/TimeLimitedDomainCdf.re | 2 +- src/lib/Prop.re | 25 +++++++--- src/lib/Types.re | 92 +++++++++++++++++++++---------------- src/utility/CdfLibrary.re | 8 ++-- 5 files changed, 84 insertions(+), 54 deletions(-) diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re index 9cf7d18f..675304a3 100644 --- a/src/LimitedDomainCdf.re +++ b/src/LimitedDomainCdf.re @@ -1,12 +1,17 @@ type t = { - distribution: Types.distribution, + distribution: Types.ContinuousDistribution.t, domainMaxX: float, }; let make = (~distribution, ~domainMaxX): t => {distribution, domainMaxX}; -let fromCdf = (cdf: Types.cdf, domainMaxX: float, probabilityAtMaxX: float) => { - let distribution: Types.distribution = { +let fromCdf = + ( + cdf: Types.ContinuousDistribution.t, + domainMaxX: float, + probabilityAtMaxX: float, + ) => { + let distribution: Types.ContinuousDistribution.t = { xs: cdf.xs, ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), }; diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re index 78aee494..f19067b9 100644 --- a/src/TimeLimitedDomainCdf.re +++ b/src/TimeLimitedDomainCdf.re @@ -66,7 +66,7 @@ type t = { let make = ( ~timeVector: timeVector, - ~distribution: Types.distribution, + ~distribution: Types.ContinuousDistribution.t, ~probabilityAtMaxX: float, ~maxX: [ | `time(MomentRe.Moment.t) | `x(float)], ) diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 1eba0bd3..54841316 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -17,7 +17,7 @@ module Value = { | Conditional(conditional) | TimeLimitedDomainCdf(TimeLimitedDomainCdf.t) | TimeLimitedDomainCdfLazy( - (string => Types.distribution) => TimeLimitedDomainCdf.t, + (string => Types.ContinuousDistribution.t) => TimeLimitedDomainCdf.t, ) | ConditionalArray(array(conditional)) | FloatCdf(string); @@ -59,23 +59,34 @@ module Value = { let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); let cdf = timeLimited.limitedDomainCdf.distribution; <> - Types.toJs} /> + Types.ContinuousDistribution.toJs} /> CdfLibrary.Distribution.toPdf |> Types.toJs} + data={ + cdf + |> CdfLibrary.Distribution.toPdf + |> Types.ContinuousDistribution.toJs + } /> {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} ; | TimeLimitedDomainCdf(r) => - let cdf: Types.distribution = r.limitedDomainCdf.distribution; - <> Types.toJs} /> ; + let cdf: Types.ContinuousDistribution.t = + r.limitedDomainCdf.distribution; + <> + Types.ContinuousDistribution.toJs} /> + ; | FloatCdf(r) => - let cdf: Types.distribution = + let cdf: Types.ContinuousDistribution.t = CdfLibrary.Distribution.fromString(r, 2000); <> CdfLibrary.Distribution.toPdf |> Types.toJs} + data={ + cdf + |> CdfLibrary.Distribution.toPdf + |> Types.ContinuousDistribution.toJs + } /> {r |> ReasonReact.string} ; diff --git a/src/lib/Types.re b/src/lib/Types.re index fb7ace63..81eea880 100644 --- a/src/lib/Types.re +++ b/src/lib/Types.re @@ -1,54 +1,66 @@ -type distribution = { - xs: array(float), - ys: array(float), -}; - -let toJs = (t: distribution) => { - {"xs": t.xs, "ys": t.ys}; -}; - -let toComponentsDist = (d: distribution): ForetoldComponents.Types.Dist.t => { - xs: d.xs, - ys: d.ys, -}; - -type pdf = distribution; -type cdf = distribution; - -let foo = (b: pdf) => 3.9; -let bar: cdf = {xs: [||], ys: [||]}; - -let cc = foo(bar); - -module LimitedDomainCdf = { +module ContinuousDistribution = { type t = { - distribution, - domainMaxX: float, + xs: array(float), + ys: array(float), }; - let fromCdf = (cdf: cdf, domainMaxX: float, probabilityAtMaxX: float) => { - let distribution: distribution = { - xs: cdf.xs, - ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), - }; - {distribution, domainMaxX}; + let toJs = (t: t) => { + {"xs": t.xs, "ys": t.ys}; }; + let toComponentsDist = (d: t): ForetoldComponents.Types.Dist.t => { + xs: d.xs, + ys: d.ys, + }; + + type pdf = t; + type cdf = t; +}; + +module DiscreteDistribution = { + type t = { + xs: array(float), + ys: array(float), + }; + + let fromArray = (xs, ys) => {xs, ys}; + let _lastElement = (a: array('a)) => switch (Belt.Array.size(a)) { | 0 => None | n => Belt.Array.get(a, n) }; - let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); + let derivative = (p: t) => { + let (xs, ys) = + Belt.Array.zip(p.xs, p.ys) + ->Belt.Array.reduce([||], (items, (x, y)) => + switch (_lastElement(items)) { + | Some((_, yLast)) => [|(x, y -. yLast)|] + | None => [|(x, y)|] + } + ) + |> Belt.Array.unzip; + fromArray(xs, ys); + }; - let chanceByX = (t: t) => t.distribution; + let integral = (p: t) => { + let (xs, ys) = + Belt.Array.zip(p.xs, p.ys) + ->Belt.Array.reduce([||], (items, (x, y)) => + switch (_lastElement(items)) { + | Some((_, yLast)) => [|(x, y +. yLast)|] + | None => [|(x, y)|] + } + ) + |> Belt.Array.unzip; + fromArray(xs, ys); + }; +}; - let domainMaxX = (t: t) => t.domainMaxX; - // let probabilityDistribution = (t: t) => - // t.distribution |> CdfLibrary.Distribution.toPdf; - // let probability = (t: t, xPoint: float) => - // CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); - // let cumulativeProbability = (t: t, xPoint: float) => - // CdfLibrary.Distribution.findY(xPoint, t.distribution); +module MixedDistribution = { + type distribution = { + discrete: DiscreteDistribution.t, + continuous: ContinuousDistribution.t, + }; }; \ No newline at end of file diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re index 4ea68560..1bcf4c37 100644 --- a/src/utility/CdfLibrary.re +++ b/src/utility/CdfLibrary.re @@ -5,14 +5,16 @@ module JS = { ys: array(float), }; - let distToJs = (d: Types.distribution) => distJs(~xs=d.xs, ~ys=d.ys); + let distToJs = (d: Types.ContinuousDistribution.t) => + distJs(~xs=d.xs, ~ys=d.ys); - let jsToDist = (d: distJs): Types.distribution => { + let jsToDist = (d: distJs): Types.ContinuousDistribution.t => { xs: xsGet(d), ys: ysGet(d), }; - let doAsDist = (f, d: Types.distribution) => d |> distToJs |> f |> jsToDist; + let doAsDist = (f, d: Types.ContinuousDistribution.t) => + d |> distToJs |> f |> jsToDist; [@bs.module "./CdfLibrary.js"] external cdfToPdf: distJs => distJs = "cdfToPdf"; From 626b4f65c3a79241318cfcb47f9ed54851629d43 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 19:44:18 +0000 Subject: [PATCH 15/28] First step for GenericDistribution --- src/TimeLimitedDomainCdf.re | 60 +------------ src/lib/DistributionTypes.re | 136 +++++++++++++++++++++++++++++ src/lib/Prop.re | 58 ++++++------ src/lib/TimeTypes.re | 59 +++++++++++++ src/lib/Types.re | 2 +- src/utility/CdfLibrary.re | 34 +++++++- src/utility/GuesstimatorLibrary.js | 9 +- 7 files changed, 264 insertions(+), 94 deletions(-) create mode 100644 src/lib/DistributionTypes.re create mode 100644 src/lib/TimeTypes.re diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re index f19067b9..4c763957 100644 --- a/src/TimeLimitedDomainCdf.re +++ b/src/TimeLimitedDomainCdf.re @@ -1,62 +1,4 @@ -type timeUnit = [ - | `days - | `hours - | `milliseconds - | `minutes - | `months - | `quarters - | `seconds - | `weeks - | `years -]; - -type timeVector = { - zero: MomentRe.Moment.t, - unit: timeUnit, -}; - -type timePoint = { - timeVector, - value: float, -}; - -module TimePoint = { - let fromTimeVector = (timeVector, value): timePoint => {timeVector, value}; - - let toMoment = (timePoint: timePoint) => { - timePoint.timeVector.zero - |> MomentRe.Moment.add( - ~duration= - MomentRe.duration(timePoint.value, timePoint.timeVector.unit), - ); - }; - - let fromMoment = (timeVector: timeVector, moment: MomentRe.Moment.t) => - MomentRe.diff(timeVector.zero, moment, timeVector.unit); -}; - -module RelativeTimePoint = { - type timeInVector = - | Time(MomentRe.Moment.t) - | XValue(float); - - let toTime = (timeVector: timeVector, timeInVector: timeInVector) => - switch (timeInVector) { - | Time(r) => r - | XValue(r) => - timeVector.zero - |> MomentRe.Moment.add(~duration=MomentRe.duration(r, timeVector.unit)) - }; - - let _timeToX = (time, timeStart, timeUnit) => - MomentRe.diff(timeStart, time, timeUnit); - - let toXValue = (timeVector: timeVector, timeInVector: timeInVector) => - switch (timeInVector) { - | Time(r) => _timeToX(r, timeVector.zero, timeVector.unit) - | XValue(r) => r - }; -}; +open TimeTypes; type t = { timeVector, diff --git a/src/lib/DistributionTypes.re b/src/lib/DistributionTypes.re new file mode 100644 index 00000000..6c568f15 --- /dev/null +++ b/src/lib/DistributionTypes.re @@ -0,0 +1,136 @@ +type domainLimit = { + xPoint: float, + excludingProbabilityMass: float, +}; + +type domain = + | Complete + | LeftLimited(domainLimit) + | RightLimited(domainLimit) + | LeftAndRightLimited(domainLimit, domainLimit); + +type continuousShape = { + xs: array(float), + ys: array(float), +}; + +type discreteShape = { + xs: array(float), + ys: array(float), +}; + +type mixedShape = { + continuous: continuousShape, + discrete: discreteShape, + discreteProbabilityMassFraction: float, +}; + +type pointsType = + | Mixed(mixedShape) + | Discrete(discreteShape) + | Continuous(continuousShape); + +type generationSource = + | GuesstimatorString(string) + | Shape(pointsType); + +type distributionUnit = + | Unspecified + | Time(TimeTypes.timeVector); + +type probabilityType = + | Cdf + | Pdf + | Arbitrary; + +type genericDistribution = { + generationSource, + probabilityType, + domain, + unit: distributionUnit, +}; + +module Shape = { + module Continuous = { + let fromArrays = (xs, ys): continuousShape => {xs, ys}; + }; + + module Discrete = { + let fromArrays = (xs, ys): continuousShape => {xs, ys}; + }; + + module Mixed = { + let make = (~continuous, ~discrete, ~discreteProbabilityMassFraction) => { + continuous, + discrete, + discreteProbabilityMassFraction, + }; + + module Builder = { + type assumption = + | ADDS_TO_1 + | ADDS_TO_CORRECT_PROBABILITY; + type assumptions = { + continuous: assumption, + discrete: assumption, + discreteProbabilityMass: option(float), + }; + let build = (~continuous, ~discrete, ~assumptions) => + switch (assumptions) { + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: Some(r), + } => + // TODO: Fix this, it's wrong :( + Some( + make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: Some(r), + } => + Some( + make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: None, + } => + None + | _ => None + }; + }; + }; +}; + +module GenericDistribution = { + let make = + ( + ~generationSource, + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Unspecified, + (), + ) + : genericDistribution => { + generationSource, + probabilityType, + domain, + unit, + }; +}; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 54841316..51582f27 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -55,41 +55,41 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | ConditionalArray(r) => "Array" |> ReasonReact.string | Conditional(r) => r.name |> ReasonReact.string - | TimeLimitedDomainCdfLazy(r) => - let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); - let cdf = timeLimited.limitedDomainCdf.distribution; - <> - Types.ContinuousDistribution.toJs} /> - CdfLibrary.Distribution.toPdf - |> Types.ContinuousDistribution.toJs - } - /> - {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} - ; + | TimeLimitedDomainCdfLazy(r) =>
+ // let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); + // let cdf = timeLimited.limitedDomainCdf.distribution; + // <> + // Types.ContinuousDistribution.toJs} /> + // CdfLibrary.Distribution.toPdf + // |> Types.ContinuousDistribution.toJs + // } + // /> + // {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} + // ; | TimeLimitedDomainCdf(r) => let cdf: Types.ContinuousDistribution.t = r.limitedDomainCdf.distribution; <> Types.ContinuousDistribution.toJs} /> ; - | FloatCdf(r) => - let cdf: Types.ContinuousDistribution.t = - CdfLibrary.Distribution.fromString(r, 2000); - <> - CdfLibrary.Distribution.toPdf - |> Types.ContinuousDistribution.toJs - } - /> - {r |> ReasonReact.string} - ; + | FloatCdf(r) =>
+ // let cdf: Types.MixedDistribution.t = + // CdfLibrary.Distribution.fromString(r, 2000); + // <> + // CdfLibrary.Distribution.toPdf + // |> Types.ContinuousDistribution.toJs + // } + // /> + // {r |> ReasonReact.string} + // ; | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string | DateTime(r) => r |> MomentRe.Moment.defaultFormat |> ReasonReact.string diff --git a/src/lib/TimeTypes.re b/src/lib/TimeTypes.re new file mode 100644 index 00000000..db08c5bd --- /dev/null +++ b/src/lib/TimeTypes.re @@ -0,0 +1,59 @@ +type timeUnit = [ + | `days + | `hours + | `milliseconds + | `minutes + | `months + | `quarters + | `seconds + | `weeks + | `years +]; + +type timeVector = { + zero: MomentRe.Moment.t, + unit: timeUnit, +}; + +type timePoint = { + timeVector, + value: float, +}; + +module TimePoint = { + let fromTimeVector = (timeVector, value): timePoint => {timeVector, value}; + + let toMoment = (timePoint: timePoint) => { + timePoint.timeVector.zero + |> MomentRe.Moment.add( + ~duration= + MomentRe.duration(timePoint.value, timePoint.timeVector.unit), + ); + }; + + let fromMoment = (timeVector: timeVector, moment: MomentRe.Moment.t) => + MomentRe.diff(timeVector.zero, moment, timeVector.unit); +}; + +module RelativeTimePoint = { + type timeInVector = + | Time(MomentRe.Moment.t) + | XValue(float); + + let toTime = (timeVector: timeVector, timeInVector: timeInVector) => + switch (timeInVector) { + | Time(r) => r + | XValue(r) => + timeVector.zero + |> MomentRe.Moment.add(~duration=MomentRe.duration(r, timeVector.unit)) + }; + + let _timeToX = (time, timeStart, timeUnit) => + MomentRe.diff(timeStart, time, timeUnit); + + let toXValue = (timeVector: timeVector, timeInVector: timeInVector) => + switch (timeInVector) { + | Time(r) => _timeToX(r, timeVector.zero, timeVector.unit) + | XValue(r) => r + }; +}; \ No newline at end of file diff --git a/src/lib/Types.re b/src/lib/Types.re index 81eea880..dffde0f1 100644 --- a/src/lib/Types.re +++ b/src/lib/Types.re @@ -59,7 +59,7 @@ module DiscreteDistribution = { }; module MixedDistribution = { - type distribution = { + type t = { discrete: DiscreteDistribution.t, continuous: ContinuousDistribution.t, }; diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re index 1bcf4c37..59b1796c 100644 --- a/src/utility/CdfLibrary.re +++ b/src/utility/CdfLibrary.re @@ -39,8 +39,35 @@ module JS = { external scoreNonMarketCdfCdf: (int, distJs, distJs, float) => distJs = "scoreNonMarketCdfCdf"; - [@bs.module "./GuesstimatorLibrary.js"] - external toGuesstimator: (string, int) => distJs = "run"; + module Guesstimator = { + [@bs.deriving abstract] + type discrete = { + xs: array(float), + ys: array(float), + }; + + let jsToDistDiscrete = (d: discrete): Types.DiscreteDistribution.t => { + xs: xsGet(d), + ys: ysGet(d), + }; + + [@bs.deriving abstract] + type combined = { + continuous: distJs, + discrete, + }; + + let toContinous = (r: combined) => continuousGet(r) |> jsToDist; + let toDiscrete = (r: combined): Types.DiscreteDistribution.t => + discreteGet(r) |> jsToDistDiscrete; + let toMixed = (r: combined): Types.MixedDistribution.t => { + discrete: toDiscrete(r), + continuous: toContinous(r), + }; + + [@bs.module "./GuesstimatorLibrary.js"] + external toGuesstimator: (string, int) => combined = "run"; + }; }; module Distribution = { @@ -49,7 +76,8 @@ module Distribution = { let findX = (y, dist) => dist |> JS.distToJs |> JS.findX(y); let findY = (x, dist) => dist |> JS.distToJs |> JS.findY(x); let fromString = (str: string, sampleCount: int) => - JS.toGuesstimator(str, sampleCount) |> JS.jsToDist; + JS.Guesstimator.toGuesstimator(str, sampleCount) + |> JS.Guesstimator.toMixed; let integral = dist => dist |> JS.distToJs |> JS.integral; let differentialEntropy = (maxCalculationLength, dist) => dist diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js index 345ceb77..cc9f1012 100644 --- a/src/utility/GuesstimatorLibrary.js +++ b/src/utility/GuesstimatorLibrary.js @@ -33,14 +33,19 @@ const ratioSize = samples => { return minMaxRatio(minValue, maxValue); }; + const toPdf = (values, sampleCount, min, max) => { - const samples = new Samples(values); + let duplicateSamples = _(values).groupBy().pickBy(x => x.length > 1).keys().value(); + let totalLength = _.size(values); + let frequencies = duplicateSamples.map(s => ({value: parseFloat(s), percentage: totalLength/_(values).filter(x => x ==s).size()})); + let continuousSamples = _.difference(values, frequencies.map(f => f.value)); + const samples = new Samples(continuousSamples); const ratioSize$ = ratioSize(samples); const width = ratioSize$ === 'SMALL' ? 20 : 1; const cdf = samples.toCdf({ size: sampleCount, width, min, max }); - return {ys:cdf.ys, xs:cdf.xs}; + return {continuous:{ys:cdf.ys, xs:cdf.xs}, discrete: {xs: frequencies.map(f => f.value), ys: frequencies.map(f => f.percentage)}}; }; let run = (text, sampleCount, inputs=[], min=false, max=false) => { From beda0b61ed44ab2ed885d0484df09e0810e41828 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 23:01:59 +0000 Subject: [PATCH 16/28] Making model accessible with GenericDistribution --- src/LimitedDomainCdf.re | 21 +++---- src/TimeLimitedDomainCdf.re | 27 ++++---- src/lib/DistributionTypes.re | 85 ------------------------- src/lib/GenericDistribution.re | 34 ++++++++++ src/lib/Prop.re | 48 ++++++-------- src/lib/Shape.re | 108 ++++++++++++++++++++++++++++++++ src/models/EAFunds.re | 14 ++++- src/models/GlobalCatastrophe.re | 15 ++--- src/utility/CdfLibrary.re | 43 +------------ src/utility/Guesstimator.re | 42 +++++++++++++ 10 files changed, 248 insertions(+), 189 deletions(-) create mode 100644 src/lib/GenericDistribution.re create mode 100644 src/lib/Shape.re create mode 100644 src/utility/Guesstimator.re diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re index 675304a3..3eeeda59 100644 --- a/src/LimitedDomainCdf.re +++ b/src/LimitedDomainCdf.re @@ -26,19 +26,18 @@ let _lastElement = (a: array('a)) => let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); -let domainMaxX = (t: t) => t.domainMaxX; +let domainMaxX = (t: t) => t.domainMaxX /* CdfLibrary.Distribution.findX(yPoint, t.distribution)*/; -let probabilityDistribution = (t: t) => - t.distribution |> CdfLibrary.Distribution.toPdf; +// let probabilityDistribution = (t: t) => +// t.distribution |> CdfLibrary.Distribution.toPdf; -let probability = (t: t, xPoint: float) => - CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); +// let probability = (t: t, xPoint: float) => +// CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); -let probabilityInverse = (t: t, yPoint: float) => - CdfLibrary.Distribution.findX(yPoint, probabilityDistribution(t)); +// let probabilityInverse = (t: t, yPoint: float) => +// CdfLibrary.Distribution.findX(yPoint, probabilityDistribution(t)); -let cumulativeProbability = (t: t, xPoint: float) => - CdfLibrary.Distribution.findY(xPoint, t.distribution); +// let cumulativeProbability = (t: t, xPoint: float) => +// CdfLibrary.Distribution.findY(xPoint, t.distribution); -let cumulativeProbabilityInverse = (t: t, yPoint: float) => - CdfLibrary.Distribution.findX(yPoint, t.distribution); \ No newline at end of file +// let cumulativeProbabilityInverse = (t: t, yPoint: float) => \ No newline at end of file diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re index 4c763957..aa8e08c9 100644 --- a/src/TimeLimitedDomainCdf.re +++ b/src/TimeLimitedDomainCdf.re @@ -27,21 +27,20 @@ let probabilityBeforeDomainMax = (t: t) => LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); let domainMaxX = (t: t) => - LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); + LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf) /* |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r)))*/; -let probability = (t: t, m: MomentRe.Moment.t) => { - RelativeTimePoint.toXValue(t.timeVector, Time(m)) - |> LimitedDomainCdf.probability(t.limitedDomainCdf); -}; +// let probability = (t: t, m: MomentRe.Moment.t) => { +// RelativeTimePoint.toXValue(t.timeVector, Time(m)) +// |> LimitedDomainCdf.probability(t.limitedDomainCdf); +// }; -let probabilityInverse = (t: t, y: float) => - LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y) - |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); +// let probabilityInverse = (t: t, y: float) => +// LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y) +// |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); -let cumulativeProbability = (t: t, m: MomentRe.Moment.t) => - RelativeTimePoint.toXValue(t.timeVector, Time(m)) - |> LimitedDomainCdf.cumulativeProbability(t.limitedDomainCdf); +// let cumulativeProbability = (t: t, m: MomentRe.Moment.t) => +// RelativeTimePoint.toXValue(t.timeVector, Time(m)) +// |> LimitedDomainCdf.cumulativeProbability(t.limitedDomainCdf); -let cumulativeProbabilityInverse = (t: t, y: float) => - LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y) - |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); \ No newline at end of file +// let cumulativeProbabilityInverse = (t: t, y: float) => +// LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y) \ No newline at end of file diff --git a/src/lib/DistributionTypes.re b/src/lib/DistributionTypes.re index 6c568f15..498c33de 100644 --- a/src/lib/DistributionTypes.re +++ b/src/lib/DistributionTypes.re @@ -48,89 +48,4 @@ type genericDistribution = { probabilityType, domain, unit: distributionUnit, -}; - -module Shape = { - module Continuous = { - let fromArrays = (xs, ys): continuousShape => {xs, ys}; - }; - - module Discrete = { - let fromArrays = (xs, ys): continuousShape => {xs, ys}; - }; - - module Mixed = { - let make = (~continuous, ~discrete, ~discreteProbabilityMassFraction) => { - continuous, - discrete, - discreteProbabilityMassFraction, - }; - - module Builder = { - type assumption = - | ADDS_TO_1 - | ADDS_TO_CORRECT_PROBABILITY; - type assumptions = { - continuous: assumption, - discrete: assumption, - discreteProbabilityMass: option(float), - }; - let build = (~continuous, ~discrete, ~assumptions) => - switch (assumptions) { - | { - continuous: ADDS_TO_CORRECT_PROBABILITY, - discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: Some(r), - } => - // TODO: Fix this, it's wrong :( - Some( - make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), - ) - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_1, - discreteProbabilityMass: Some(r), - } => - Some( - make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), - ) - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_1, - discreteProbabilityMass: None, - } => - None - | { - continuous: ADDS_TO_CORRECT_PROBABILITY, - discrete: ADDS_TO_1, - discreteProbabilityMass: None, - } => - None - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: None, - } => - None - | _ => None - }; - }; - }; -}; - -module GenericDistribution = { - let make = - ( - ~generationSource, - ~probabilityType=Pdf, - ~domain=Complete, - ~unit=Unspecified, - (), - ) - : genericDistribution => { - generationSource, - probabilityType, - domain, - unit, - }; }; \ No newline at end of file diff --git a/src/lib/GenericDistribution.re b/src/lib/GenericDistribution.re new file mode 100644 index 00000000..515382e6 --- /dev/null +++ b/src/lib/GenericDistribution.re @@ -0,0 +1,34 @@ +open DistributionTypes; +let make = + ( + ~generationSource, + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Unspecified, + (), + ) + : genericDistribution => { + generationSource, + probabilityType, + domain, + unit, +}; + +let renderIfNeeded = + (~sampleCount=1000, t: genericDistribution): option(genericDistribution) => { + switch (t.generationSource) { + | GuesstimatorString(s) => + let shape = Guesstimator.stringToMixedShape(~string=s, ~sampleCount, ()); + shape + |> E.O.fmap((shape: DistributionTypes.mixedShape) => + make( + ~generationSource=Shape(Mixed(shape)), + ~probabilityType=Cdf, + ~domain=t.domain, + ~unit=t.unit, + (), + ) + ); + | Shape(_) => Some(t) + }; +}; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 51582f27..8655629a 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -15,6 +15,7 @@ module Value = { | FloatPoint(float) | Probability(float) | Conditional(conditional) + | GenericDistribution(DistributionTypes.genericDistribution) | TimeLimitedDomainCdf(TimeLimitedDomainCdf.t) | TimeLimitedDomainCdfLazy( (string => Types.ContinuousDistribution.t) => TimeLimitedDomainCdf.t, @@ -31,6 +32,7 @@ module Value = { } | SelectSingle(r) => r | FloatCdf(r) => r + | GenericDistribution(_) => "" | TimeLimitedDomainCdf(_) => "" | TimeLimitedDomainCdfLazy(_) => "" | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" @@ -55,41 +57,29 @@ module Value = { | SelectSingle(r) => r |> ReasonReact.string | ConditionalArray(r) => "Array" |> ReasonReact.string | Conditional(r) => r.name |> ReasonReact.string - | TimeLimitedDomainCdfLazy(r) =>
- // let timeLimited = r(CdfLibrary.Distribution.fromString(_, 1000)); - // let cdf = timeLimited.limitedDomainCdf.distribution; - // <> - // Types.ContinuousDistribution.toJs} /> - // CdfLibrary.Distribution.toPdf - // |> Types.ContinuousDistribution.toJs - // } - // /> - // {FloatCdf.logNormal(50., 20.) |> ReasonReact.string} - // ; + | GenericDistribution(r) => + let newDistribution = + GenericDistribution.renderIfNeeded(~sampleCount=1000, r); + switch (newDistribution) { + | Some({generationSource: Shape(Mixed({continuous: n}))}) => +
+ Shape.Continuous.toJs} /> + Shape.Continuous.toCdf |> Shape.Continuous.toJs} + /> +
+ | None => "Something went wrong" |> ReasonReact.string + | _ =>
+ }; + | TimeLimitedDomainCdfLazy(_) =>
| TimeLimitedDomainCdf(r) => let cdf: Types.ContinuousDistribution.t = r.limitedDomainCdf.distribution; <> Types.ContinuousDistribution.toJs} /> ; - | FloatCdf(r) =>
- // let cdf: Types.MixedDistribution.t = - // CdfLibrary.Distribution.fromString(r, 2000); - // <> - // CdfLibrary.Distribution.toPdf - // |> Types.ContinuousDistribution.toJs - // } - // /> - // {r |> ReasonReact.string} - // ; + | FloatCdf(_) =>
| Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string | DateTime(r) => r |> MomentRe.Moment.defaultFormat |> ReasonReact.string diff --git a/src/lib/Shape.re b/src/lib/Shape.re new file mode 100644 index 00000000..b99698c9 --- /dev/null +++ b/src/lib/Shape.re @@ -0,0 +1,108 @@ +open DistributionTypes; + +module Continuous = { + let fromArrays = (xs, ys): continuousShape => {xs, ys}; + let toJs = (t: continuousShape) => { + {"xs": t.xs, "ys": t.ys}; + }; + let toPdf = CdfLibrary.Distribution.toPdf; + let toCdf = CdfLibrary.Distribution.toCdf; + let findX = CdfLibrary.Distribution.findX; + let findY = CdfLibrary.Distribution.findY; +}; + +module Discrete = { + type t = discreteShape; + let fromArrays = (xs, ys): discreteShape => {xs, ys}; + let _lastElement = (a: array('a)) => + switch (Belt.Array.size(a)) { + | 0 => None + | n => Belt.Array.get(a, n) + }; + + let derivative = (p: t) => { + let (xs, ys) = + Belt.Array.zip(p.xs, p.ys) + ->Belt.Array.reduce([||], (items, (x, y)) => + switch (_lastElement(items)) { + | Some((_, yLast)) => [|(x, y -. yLast)|] + | None => [|(x, y)|] + } + ) + |> Belt.Array.unzip; + fromArrays(xs, ys); + }; + + let integral = (p: t) => { + let (xs, ys) = + Belt.Array.zip(p.xs, p.ys) + ->Belt.Array.reduce([||], (items, (x, y)) => + switch (_lastElement(items)) { + | Some((_, yLast)) => [|(x, y +. yLast)|] + | None => [|(x, y)|] + } + ) + |> Belt.Array.unzip; + fromArrays(xs, ys); + }; +}; + +module Mixed = { + let make = (~continuous, ~discrete, ~discreteProbabilityMassFraction) => { + continuous, + discrete, + discreteProbabilityMassFraction, + }; + + module Builder = { + type assumption = + | ADDS_TO_1 + | ADDS_TO_CORRECT_PROBABILITY; + type assumptions = { + continuous: assumption, + discrete: assumption, + discreteProbabilityMass: option(float), + }; + let build = (~continuous, ~discrete, ~assumptions) => + switch (assumptions) { + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: Some(r), + } => + // TODO: Fix this, it's wrong :( + Some( + make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: Some(r), + } => + Some( + make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: Some(r), + } => + Some( + make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), + ) + | _ => None + }; + }; +}; \ No newline at end of file diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 9a43ca98..4e9dbc87 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -113,14 +113,22 @@ module Model = { switch (output) { | DONATIONS | PAYOUTS => - Prop.Value.FloatCdf( + let difference = calculateDifference( currentValue(group, output), dateTime, currentDateTime, yearlyMeanGrowthRateIfNotClosed(group), - ), - ) + ); + let genericDistribution = + GenericDistribution.make( + ~generationSource=GuesstimatorString(difference), + ~probabilityType=Cdf, + ~domain=Complete, + ~unit=Unspecified, + (), + ); + Prop.Value.GenericDistribution(genericDistribution); | CHANCE_OF_EXISTENCE => let lazyDistribution = r => TimeLimitedDomainCdf.make( diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index ddd9c196..c98ce11a 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,13 +1,14 @@ module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { - let lazyDistribution = r => - TimeLimitedDomainCdf.make( - ~timeVector={zero: currentDateTime, unit: `years}, - ~distribution=r(FloatCdf.logNormal(20., 3.)), - ~probabilityAtMaxX=0.7, - ~maxX=`x(200.), + let genericDistribution = + GenericDistribution.make( + ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), + ~probabilityType=Cdf, + ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), + ~unit=Time({zero: currentDateTime, unit: `years}), + (), ); - Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution); + Prop.Value.GenericDistribution(genericDistribution); }; }; diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re index 59b1796c..fdc08392 100644 --- a/src/utility/CdfLibrary.re +++ b/src/utility/CdfLibrary.re @@ -5,15 +5,15 @@ module JS = { ys: array(float), }; - let distToJs = (d: Types.ContinuousDistribution.t) => + let distToJs = (d: DistributionTypes.continuousShape) => distJs(~xs=d.xs, ~ys=d.ys); - let jsToDist = (d: distJs): Types.ContinuousDistribution.t => { + let jsToDist = (d: distJs): DistributionTypes.continuousShape => { xs: xsGet(d), ys: ysGet(d), }; - let doAsDist = (f, d: Types.ContinuousDistribution.t) => + let doAsDist = (f, d: DistributionTypes.continuousShape) => d |> distToJs |> f |> jsToDist; [@bs.module "./CdfLibrary.js"] @@ -34,40 +34,6 @@ module JS = { [@bs.module "./CdfLibrary.js"] external differentialEntropy: (int, distJs) => distJs = "differentialEntropy"; - - [@bs.module "./CdfLibrary.js"] - external scoreNonMarketCdfCdf: (int, distJs, distJs, float) => distJs = - "scoreNonMarketCdfCdf"; - - module Guesstimator = { - [@bs.deriving abstract] - type discrete = { - xs: array(float), - ys: array(float), - }; - - let jsToDistDiscrete = (d: discrete): Types.DiscreteDistribution.t => { - xs: xsGet(d), - ys: ysGet(d), - }; - - [@bs.deriving abstract] - type combined = { - continuous: distJs, - discrete, - }; - - let toContinous = (r: combined) => continuousGet(r) |> jsToDist; - let toDiscrete = (r: combined): Types.DiscreteDistribution.t => - discreteGet(r) |> jsToDistDiscrete; - let toMixed = (r: combined): Types.MixedDistribution.t => { - discrete: toDiscrete(r), - continuous: toContinous(r), - }; - - [@bs.module "./GuesstimatorLibrary.js"] - external toGuesstimator: (string, int) => combined = "run"; - }; }; module Distribution = { @@ -75,9 +41,6 @@ module Distribution = { let toCdf = dist => dist |> JS.doAsDist(JS.cdfToPdf); let findX = (y, dist) => dist |> JS.distToJs |> JS.findX(y); let findY = (x, dist) => dist |> JS.distToJs |> JS.findY(x); - let fromString = (str: string, sampleCount: int) => - JS.Guesstimator.toGuesstimator(str, sampleCount) - |> JS.Guesstimator.toMixed; let integral = dist => dist |> JS.distToJs |> JS.integral; let differentialEntropy = (maxCalculationLength, dist) => dist diff --git a/src/utility/Guesstimator.re b/src/utility/Guesstimator.re new file mode 100644 index 00000000..995616d9 --- /dev/null +++ b/src/utility/Guesstimator.re @@ -0,0 +1,42 @@ +module Internals = { + [@bs.deriving abstract] + type discrete = { + xs: array(float), + ys: array(float), + }; + + let jsToDistDiscrete = (d: discrete): DistributionTypes.discreteShape => { + xs: xsGet(d), + ys: ysGet(d), + }; + + [@bs.deriving abstract] + type combined = { + continuous: CdfLibrary.JS.distJs, + discrete, + }; + + let toContinous = (r: combined): DistributionTypes.continuousShape => + continuousGet(r) |> CdfLibrary.JS.jsToDist; + let toDiscrete = (r: combined): DistributionTypes.discreteShape => + discreteGet(r) |> jsToDistDiscrete; + + [@bs.module "./GuesstimatorLibrary.js"] + external toCombinedFormat: (string, int) => combined = "run"; + + let toMixedShape = (r: combined): option(DistributionTypes.mixedShape) => { + let assumptions: Shape.Mixed.Builder.assumptions = { + continuous: ADDS_TO_1, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: Some(0.3), + }; + Shape.Mixed.Builder.build( + ~continuous=toContinous(r), + ~discrete=toDiscrete(r), + ~assumptions, + ); + }; +}; + +let stringToMixedShape = (~string, ~sampleCount=1000, ()) => + Internals.toCombinedFormat(string, sampleCount) |> Internals.toMixedShape; \ No newline at end of file From 03cc7293a4de67b072f588172897078c7286d440 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 15 Feb 2020 23:27:25 +0000 Subject: [PATCH 17/28] Basic mixed discrete-continuous distributions --- src/lib/Prop.re | 7 ++----- src/lib/Shape.re | 12 ++++++++++++ src/models/GlobalCatastrophe.re | 4 +++- src/utility/GuesstimatorLibrary.js | 26 ++++++++++++++++++-------- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 8655629a..4221cb98 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -61,13 +61,10 @@ module Value = { let newDistribution = GenericDistribution.renderIfNeeded(~sampleCount=1000, r); switch (newDistribution) { - | Some({generationSource: Shape(Mixed({continuous: n}))}) => + | Some({generationSource: Shape(Mixed({continuous: n, discrete: d}))}) =>
Shape.Continuous.toJs} /> - Shape.Continuous.toCdf |> Shape.Continuous.toJs} - /> + {Shape.Discrete.render(d)}
| None => "Something went wrong" |> ReasonReact.string | _ =>
diff --git a/src/lib/Shape.re b/src/lib/Shape.re index b99698c9..914f2f51 100644 --- a/src/lib/Shape.re +++ b/src/lib/Shape.re @@ -45,6 +45,18 @@ module Discrete = { |> Belt.Array.unzip; fromArrays(xs, ys); }; + + let render = (t: t) => + Belt.Array.zip(t.xs, t.ys) + |> E.A.fmap(((x, y)) => +
+ {E.Float.toFixed(x) + ++ "---" + ++ E.Float.with3DigitsPrecision(y *. 100.) + |> ReasonReact.string} +
+ ) + |> ReasonReact.array; }; module Mixed = { diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index c98ce11a..1f62dc49 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,8 +1,10 @@ +// ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { let genericDistribution = GenericDistribution.make( - ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), + ~generationSource= + GuesstimatorString("mm(floor(10 to 15), 20 to 30, [.5,.5])"), ~probabilityType=Cdf, ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), ~unit=Time({zero: currentDateTime, unit: `years}), diff --git a/src/utility/GuesstimatorLibrary.js b/src/utility/GuesstimatorLibrary.js index cc9f1012..7037dc46 100644 --- a/src/utility/GuesstimatorLibrary.js +++ b/src/utility/GuesstimatorLibrary.js @@ -37,15 +37,21 @@ const ratioSize = samples => { const toPdf = (values, sampleCount, min, max) => { let duplicateSamples = _(values).groupBy().pickBy(x => x.length > 1).keys().value(); let totalLength = _.size(values); - let frequencies = duplicateSamples.map(s => ({value: parseFloat(s), percentage: totalLength/_(values).filter(x => x ==s).size()})); + let frequencies = duplicateSamples.map(s => ({value: parseFloat(s), percentage: _(values).filter(x => x ==s).size()/totalLength})); let continuousSamples = _.difference(values, frequencies.map(f => f.value)); - const samples = new Samples(continuousSamples); - const ratioSize$ = ratioSize(samples); - const width = ratioSize$ === 'SMALL' ? 20 : 1; + let discrete = {xs: frequencies.map(f => f.value), ys: frequencies.map(f => f.percentage)}; + let continuous = {ys: [], xs: []}; + if (continuousSamples.length > 1){ + const samples = new Samples(continuousSamples); - const cdf = samples.toCdf({ size: sampleCount, width, min, max }); - return {continuous:{ys:cdf.ys, xs:cdf.xs}, discrete: {xs: frequencies.map(f => f.value), ys: frequencies.map(f => f.percentage)}}; + const ratioSize$ = ratioSize(samples); + const width = ratioSize$ === 'SMALL' ? 20 : 1; + + const cdf = samples.toCdf({ size: sampleCount, width, min, max }); + continuous = cdf; + } + return {continuous, discrete}; }; let run = (text, sampleCount, inputs=[], min=false, max=false) => { @@ -63,10 +69,14 @@ let run = (text, sampleCount, inputs=[], min=false, max=false) => { const values = _.filter(value.values, _.isFinite); let update; + let blankResponse = { + continuous: {ys: [], xs: []}, + discrete: {ys: [], xs: []} + }; if (values.length === 0) { - update = {xs: [], ys: []}; + update = blankResponse; } else if (values.length === 1) { - update = {xs: [], ys: []}; + update = blankResponse; } else { update = toPdf(values, sampleCount, min, max); } From 5de75a402be706ea71ad92ce0ee379ab96b7a67c Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 16 Feb 2020 11:01:37 +0000 Subject: [PATCH 18/28] Improved handling of mixed discreteProbabilityMassFraction --- src/lib/Prop.re | 13 +++++++++++-- src/lib/Shape.re | 20 +++++++++++++++----- src/utility/Guesstimator.re | 2 +- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/lib/Prop.re b/src/lib/Prop.re index 4221cb98..eac149ff 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -61,10 +61,19 @@ module Value = { let newDistribution = GenericDistribution.renderIfNeeded(~sampleCount=1000, r); switch (newDistribution) { - | Some({generationSource: Shape(Mixed({continuous: n, discrete: d}))}) => + | Some({ + generationSource: + Shape( + Mixed({ + continuous: n, + discrete: d, + discreteProbabilityMassFraction: f, + }), + ), + }) =>
Shape.Continuous.toJs} /> - {Shape.Discrete.render(d)} + {d |> Shape.Discrete.scaleYToTotal(f) |> Shape.Discrete.render}
| None => "Something went wrong" |> ReasonReact.string | _ =>
diff --git a/src/lib/Shape.re b/src/lib/Shape.re index 914f2f51..c98500f8 100644 --- a/src/lib/Shape.re +++ b/src/lib/Shape.re @@ -38,7 +38,7 @@ module Discrete = { Belt.Array.zip(p.xs, p.ys) ->Belt.Array.reduce([||], (items, (x, y)) => switch (_lastElement(items)) { - | Some((_, yLast)) => [|(x, y +. yLast)|] + | Some((_, yLast)) => E.A.append(items, [|(x, y +. yLast)|]) | None => [|(x, y)|] } ) @@ -46,6 +46,16 @@ module Discrete = { fromArrays(xs, ys); }; + let ySum = (t: t) => { + E.A.fold_left((a, b) => a +. b, 0., t.ys); + }; + + let scaleYToTotal = (totalDesired, t: t): t => { + let currentSum = ySum(t); + let difference = totalDesired /. currentSum; + {xs: t.xs, ys: t.ys |> E.A.fmap(y => y *. difference)}; + }; + let render = (t: t) => Belt.Array.zip(t.xs, t.ys) |> E.A.fmap(((x, y)) => @@ -109,11 +119,11 @@ module Mixed = { | { continuous: ADDS_TO_1, discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: Some(r), + discreteProbabilityMass: None, } => - Some( - make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), - ) + let discreteProbabilityMassFraction = Discrete.ySum(discrete); + let discrete = Discrete.scaleYToTotal(1.0, discrete); + Some(make(~continuous, ~discrete, ~discreteProbabilityMassFraction)); | _ => None }; }; diff --git a/src/utility/Guesstimator.re b/src/utility/Guesstimator.re index 995616d9..560ca798 100644 --- a/src/utility/Guesstimator.re +++ b/src/utility/Guesstimator.re @@ -28,7 +28,7 @@ module Internals = { let assumptions: Shape.Mixed.Builder.assumptions = { continuous: ADDS_TO_1, discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: Some(0.3), + discreteProbabilityMass: None, }; Shape.Mixed.Builder.build( ~continuous=toContinous(r), From 61645243f92dbafc6ab3af699f84b7dba243af36 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 16 Feb 2020 11:45:19 +0000 Subject: [PATCH 19/28] Simple refactoring too add functionality in Shape.re --- src/Experimental/LimitedDomainCdf.re | 33 ++++++ src/Experimental/TimeLimitedDomainCdf.re | 38 ++++++ src/LimitedDomainCdf.re | 43 ------- src/TimeLimitedDomainCdf.re | 46 ------- src/lib/DistributionTypes.re | 8 +- src/lib/MixedShapeBuilder.re | 63 ++++++++++ src/lib/Prop.re | 13 -- src/lib/Shape.re | 145 ++++++++--------------- src/lib/Types.re | 66 ----------- src/models/EAFunds.re | 10 +- src/models/GlobalCatastrophe.re | 5 +- src/utility/Guesstimator.re | 4 +- 12 files changed, 193 insertions(+), 281 deletions(-) create mode 100644 src/Experimental/LimitedDomainCdf.re create mode 100644 src/Experimental/TimeLimitedDomainCdf.re delete mode 100644 src/LimitedDomainCdf.re delete mode 100644 src/TimeLimitedDomainCdf.re create mode 100644 src/lib/MixedShapeBuilder.re diff --git a/src/Experimental/LimitedDomainCdf.re b/src/Experimental/LimitedDomainCdf.re new file mode 100644 index 00000000..126cf5d1 --- /dev/null +++ b/src/Experimental/LimitedDomainCdf.re @@ -0,0 +1,33 @@ +// type t = { + // distribution: Types.ContinuousDistribution.t, + // domainMaxX: float, + // }; + // let make = (~distribution, ~domainMaxX): t => {distribution, domainMaxX}; + // let fromCdf = + // ( + // cdf: Types.ContinuousDistribution.t, + // domainMaxX: float, + // probabilityAtMaxX: float, + // ) => { + // let distribution: Types.ContinuousDistribution.t = { + // xs: cdf.xs, + // ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), + // }; + // {distribution, domainMaxX}; + // }; + // let _lastElement = (a: array('a)) => + // switch (Belt.Array.size(a)) { + // | 0 => None + // | n => Belt.Array.get(a, n) + // }; + // let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); + // let domainMaxX = (t: t) => t.domainMaxX /* CdfLibrary.Distribution.findX(yPoint, t.distribution)*/; + // let probabilityDistribution = (t: t) => + // t.distribution |> CdfLibrary.Distribution.toPdf; + // let probability = (t: t, xPoint: float) => + // CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); + // let probabilityInverse = (t: t, yPoint: float) => + // CdfLibrary.Distribution.findX(yPoint, probabilityDistribution(t)); + // let cumulativeProbability = (t: t, xPoint: float) => + // CdfLibrary.Distribution.findY(xPoint, t.distribution); + /* let cumulativeProbabilityInverse = (t: t, yPoint: float) =*/ \ No newline at end of file diff --git a/src/Experimental/TimeLimitedDomainCdf.re b/src/Experimental/TimeLimitedDomainCdf.re new file mode 100644 index 00000000..9c4c3b67 --- /dev/null +++ b/src/Experimental/TimeLimitedDomainCdf.re @@ -0,0 +1,38 @@ +// open TimeTypes; + // type t = { + // timeVector, + // limitedDomainCdf: LimitedDomainCdf.t, + // }; + // let make = + // ( + // ~timeVector: timeVector, + // ~distribution: Types.ContinuousDistribution.t, + // ~probabilityAtMaxX: float, + // ~maxX: [ | `time(MomentRe.Moment.t) | `x(float)], + // ) + // : t => { + // let domainMaxX = + // switch (maxX) { + // | `time(m) => TimePoint.fromMoment(timeVector, m) + // | `x(r) => r + // }; + // let limitedDomainCdf = + // LimitedDomainCdf.fromCdf(distribution, domainMaxX, probabilityAtMaxX); + // {timeVector, limitedDomainCdf}; + // }; + // let probabilityBeforeDomainMax = (t: t) => + // LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); + // let domainMaxX = (t: t) => + // LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf) /* |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r)))*/; + // let probability = (t: t, m: MomentRe.Moment.t) => { + // RelativeTimePoint.toXValue(t.timeVector, Time(m)) + // |> LimitedDomainCdf.probability(t.limitedDomainCdf); + // }; + // let probabilityInverse = (t: t, y: float) => + // LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y) + // |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); + // let cumulativeProbability = (t: t, m: MomentRe.Moment.t) => + // RelativeTimePoint.toXValue(t.timeVector, Time(m)) + // |> LimitedDomainCdf.cumulativeProbability(t.limitedDomainCdf); + // let cumulativeProbabilityInverse = (t: t, y: float) => + /* LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y*/ \ No newline at end of file diff --git a/src/LimitedDomainCdf.re b/src/LimitedDomainCdf.re deleted file mode 100644 index 3eeeda59..00000000 --- a/src/LimitedDomainCdf.re +++ /dev/null @@ -1,43 +0,0 @@ -type t = { - distribution: Types.ContinuousDistribution.t, - domainMaxX: float, -}; - -let make = (~distribution, ~domainMaxX): t => {distribution, domainMaxX}; - -let fromCdf = - ( - cdf: Types.ContinuousDistribution.t, - domainMaxX: float, - probabilityAtMaxX: float, - ) => { - let distribution: Types.ContinuousDistribution.t = { - xs: cdf.xs, - ys: cdf.ys |> E.A.fmap(r => r *. probabilityAtMaxX), - }; - {distribution, domainMaxX}; -}; - -let _lastElement = (a: array('a)) => - switch (Belt.Array.size(a)) { - | 0 => None - | n => Belt.Array.get(a, n) - }; - -let probabilityBeforeDomainMax = (t: t) => _lastElement(t.distribution.ys); - -let domainMaxX = (t: t) => t.domainMaxX /* CdfLibrary.Distribution.findX(yPoint, t.distribution)*/; - -// let probabilityDistribution = (t: t) => -// t.distribution |> CdfLibrary.Distribution.toPdf; - -// let probability = (t: t, xPoint: float) => -// CdfLibrary.Distribution.findY(xPoint, probabilityDistribution(t)); - -// let probabilityInverse = (t: t, yPoint: float) => -// CdfLibrary.Distribution.findX(yPoint, probabilityDistribution(t)); - -// let cumulativeProbability = (t: t, xPoint: float) => -// CdfLibrary.Distribution.findY(xPoint, t.distribution); - -// let cumulativeProbabilityInverse = (t: t, yPoint: float) => \ No newline at end of file diff --git a/src/TimeLimitedDomainCdf.re b/src/TimeLimitedDomainCdf.re deleted file mode 100644 index aa8e08c9..00000000 --- a/src/TimeLimitedDomainCdf.re +++ /dev/null @@ -1,46 +0,0 @@ -open TimeTypes; - -type t = { - timeVector, - limitedDomainCdf: LimitedDomainCdf.t, -}; - -let make = - ( - ~timeVector: timeVector, - ~distribution: Types.ContinuousDistribution.t, - ~probabilityAtMaxX: float, - ~maxX: [ | `time(MomentRe.Moment.t) | `x(float)], - ) - : t => { - let domainMaxX = - switch (maxX) { - | `time(m) => TimePoint.fromMoment(timeVector, m) - | `x(r) => r - }; - let limitedDomainCdf = - LimitedDomainCdf.fromCdf(distribution, domainMaxX, probabilityAtMaxX); - {timeVector, limitedDomainCdf}; -}; - -let probabilityBeforeDomainMax = (t: t) => - LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf); - -let domainMaxX = (t: t) => - LimitedDomainCdf.probabilityBeforeDomainMax(t.limitedDomainCdf) /* |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r)))*/; - -// let probability = (t: t, m: MomentRe.Moment.t) => { -// RelativeTimePoint.toXValue(t.timeVector, Time(m)) -// |> LimitedDomainCdf.probability(t.limitedDomainCdf); -// }; - -// let probabilityInverse = (t: t, y: float) => -// LimitedDomainCdf.probabilityInverse(t.limitedDomainCdf, y) -// |> (r => RelativeTimePoint.toTime(t.timeVector, XValue(r))); - -// let cumulativeProbability = (t: t, m: MomentRe.Moment.t) => -// RelativeTimePoint.toXValue(t.timeVector, Time(m)) -// |> LimitedDomainCdf.cumulativeProbability(t.limitedDomainCdf); - -// let cumulativeProbabilityInverse = (t: t, y: float) => -// LimitedDomainCdf.cumulativeProbabilityInverse(t.limitedDomainCdf, y) \ No newline at end of file diff --git a/src/lib/DistributionTypes.re b/src/lib/DistributionTypes.re index 498c33de..c8b4db27 100644 --- a/src/lib/DistributionTypes.re +++ b/src/lib/DistributionTypes.re @@ -9,15 +9,13 @@ type domain = | RightLimited(domainLimit) | LeftAndRightLimited(domainLimit, domainLimit); -type continuousShape = { +type xyShape = { xs: array(float), ys: array(float), }; +type continuousShape = xyShape; -type discreteShape = { - xs: array(float), - ys: array(float), -}; +type discreteShape = xyShape; type mixedShape = { continuous: continuousShape, diff --git a/src/lib/MixedShapeBuilder.re b/src/lib/MixedShapeBuilder.re new file mode 100644 index 00000000..9ed0ca0a --- /dev/null +++ b/src/lib/MixedShapeBuilder.re @@ -0,0 +1,63 @@ +type assumption = + | ADDS_TO_1 + | ADDS_TO_CORRECT_PROBABILITY; +type assumptions = { + continuous: assumption, + discrete: assumption, + discreteProbabilityMass: option(float), +}; +let build = (~continuous, ~discrete, ~assumptions) => + switch (assumptions) { + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: Some(r), + } => + // TODO: Fix this, it's wrong :( + Some( + Shape.Mixed.make( + ~continuous, + ~discrete, + ~discreteProbabilityMassFraction=r, + ), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: Some(r), + } => + Some( + Shape.Mixed.make( + ~continuous, + ~discrete, + ~discreteProbabilityMassFraction=r, + ), + ) + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_CORRECT_PROBABILITY, + discrete: ADDS_TO_1, + discreteProbabilityMass: None, + } => + None + | { + continuous: ADDS_TO_1, + discrete: ADDS_TO_CORRECT_PROBABILITY, + discreteProbabilityMass: None, + } => + let discreteProbabilityMassFraction = Shape.Discrete.ySum(discrete); + let discrete = Shape.Discrete.scaleYToTotal(1.0, discrete); + Some( + Shape.Mixed.make( + ~continuous, + ~discrete, + ~discreteProbabilityMassFraction, + ), + ); + | _ => None + }; \ No newline at end of file diff --git a/src/lib/Prop.re b/src/lib/Prop.re index eac149ff..92827695 100644 --- a/src/lib/Prop.re +++ b/src/lib/Prop.re @@ -16,10 +16,6 @@ module Value = { | Probability(float) | Conditional(conditional) | GenericDistribution(DistributionTypes.genericDistribution) - | TimeLimitedDomainCdf(TimeLimitedDomainCdf.t) - | TimeLimitedDomainCdfLazy( - (string => Types.ContinuousDistribution.t) => TimeLimitedDomainCdf.t, - ) | ConditionalArray(array(conditional)) | FloatCdf(string); @@ -33,8 +29,6 @@ module Value = { | SelectSingle(r) => r | FloatCdf(r) => r | GenericDistribution(_) => "" - | TimeLimitedDomainCdf(_) => "" - | TimeLimitedDomainCdfLazy(_) => "" | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" | DateTime(r) => r |> MomentRe.Moment.defaultFormat | FloatPoint(r) => r |> Js.Float.toFixed @@ -78,13 +72,6 @@ module Value = { | None => "Something went wrong" |> ReasonReact.string | _ =>
}; - | TimeLimitedDomainCdfLazy(_) =>
- | TimeLimitedDomainCdf(r) => - let cdf: Types.ContinuousDistribution.t = - r.limitedDomainCdf.distribution; - <> - Types.ContinuousDistribution.toJs} /> - ; | FloatCdf(_) =>
| Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string diff --git a/src/lib/Shape.re b/src/lib/Shape.re index c98500f8..a0a90b5c 100644 --- a/src/lib/Shape.re +++ b/src/lib/Shape.re @@ -1,10 +1,46 @@ open DistributionTypes; -module Continuous = { - let fromArrays = (xs, ys): continuousShape => {xs, ys}; - let toJs = (t: continuousShape) => { +let _lastElement = (a: array('a)) => + switch (Belt.Array.size(a)) { + | 0 => None + | n => Belt.Array.get(a, n) + }; + +module XYShape = { + type t = xyShape; + + let toJs = (t: t) => { {"xs": t.xs, "ys": t.ys}; }; + + let fmap = (t: t, y): t => {xs: t.xs, ys: t.ys |> E.A.fmap(y)}; + let yFold = (fn, t: t) => { + E.A.fold_left(fn, 0., t.ys); + }; + let ySum = yFold((a, b) => a +. b); + + let fromArrays = (xs, ys): t => {xs, ys}; + + let transverse = (fn, p: t) => { + let (xs, ys) = + Belt.Array.zip(p.xs, p.ys) + ->Belt.Array.reduce([||], (items, (x, y)) => + switch (_lastElement(items)) { + | Some((_, yLast)) => [|(x, fn(y, yLast))|] + | None => [|(x, y)|] + } + ) + |> Belt.Array.unzip; + fromArrays(xs, ys); + }; + + let derivative = transverse((aCurrent, aLast) => aCurrent -. aLast); + let integral = transverse((aCurrent, aLast) => aCurrent +. aLast); +}; + +module Continuous = { + let fromArrays = XYShape.fromArrays; + let toJs = XYShape.toJs; let toPdf = CdfLibrary.Distribution.toPdf; let toCdf = CdfLibrary.Distribution.toCdf; let findX = CdfLibrary.Distribution.findX; @@ -13,47 +49,14 @@ module Continuous = { module Discrete = { type t = discreteShape; - let fromArrays = (xs, ys): discreteShape => {xs, ys}; - let _lastElement = (a: array('a)) => - switch (Belt.Array.size(a)) { - | 0 => None - | n => Belt.Array.get(a, n) - }; - - let derivative = (p: t) => { - let (xs, ys) = - Belt.Array.zip(p.xs, p.ys) - ->Belt.Array.reduce([||], (items, (x, y)) => - switch (_lastElement(items)) { - | Some((_, yLast)) => [|(x, y -. yLast)|] - | None => [|(x, y)|] - } - ) - |> Belt.Array.unzip; - fromArrays(xs, ys); - }; - - let integral = (p: t) => { - let (xs, ys) = - Belt.Array.zip(p.xs, p.ys) - ->Belt.Array.reduce([||], (items, (x, y)) => - switch (_lastElement(items)) { - | Some((_, yLast)) => E.A.append(items, [|(x, y +. yLast)|]) - | None => [|(x, y)|] - } - ) - |> Belt.Array.unzip; - fromArrays(xs, ys); - }; - - let ySum = (t: t) => { - E.A.fold_left((a, b) => a +. b, 0., t.ys); - }; + let fromArrays = XYShape.fromArrays; + let toJs = XYShape.toJs; + let ySum = XYShape.ySum; + let zip = t => Belt.Array.zip(t.xs, t.ys); let scaleYToTotal = (totalDesired, t: t): t => { - let currentSum = ySum(t); - let difference = totalDesired /. currentSum; - {xs: t.xs, ys: t.ys |> E.A.fmap(y => y *. difference)}; + let difference = totalDesired /. ySum(t); + XYShape.fmap(t, y => y *. difference); }; let render = (t: t) => @@ -67,6 +70,12 @@ module Discrete = {
) |> ReasonReact.array; + + let findY = (x: float, t: t) => + switch (E.A.getBy(zip(t), ((ix, _)) => ix == x)) { + | Some((_, y)) => y + | None => 0. + }; }; module Mixed = { @@ -75,56 +84,4 @@ module Mixed = { discrete, discreteProbabilityMassFraction, }; - - module Builder = { - type assumption = - | ADDS_TO_1 - | ADDS_TO_CORRECT_PROBABILITY; - type assumptions = { - continuous: assumption, - discrete: assumption, - discreteProbabilityMass: option(float), - }; - let build = (~continuous, ~discrete, ~assumptions) => - switch (assumptions) { - | { - continuous: ADDS_TO_CORRECT_PROBABILITY, - discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: Some(r), - } => - // TODO: Fix this, it's wrong :( - Some( - make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), - ) - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_1, - discreteProbabilityMass: Some(r), - } => - Some( - make(~continuous, ~discrete, ~discreteProbabilityMassFraction=r), - ) - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_1, - discreteProbabilityMass: None, - } => - None - | { - continuous: ADDS_TO_CORRECT_PROBABILITY, - discrete: ADDS_TO_1, - discreteProbabilityMass: None, - } => - None - | { - continuous: ADDS_TO_1, - discrete: ADDS_TO_CORRECT_PROBABILITY, - discreteProbabilityMass: None, - } => - let discreteProbabilityMassFraction = Discrete.ySum(discrete); - let discrete = Discrete.scaleYToTotal(1.0, discrete); - Some(make(~continuous, ~discrete, ~discreteProbabilityMassFraction)); - | _ => None - }; - }; }; \ No newline at end of file diff --git a/src/lib/Types.re b/src/lib/Types.re index dffde0f1..e69de29b 100644 --- a/src/lib/Types.re +++ b/src/lib/Types.re @@ -1,66 +0,0 @@ -module ContinuousDistribution = { - type t = { - xs: array(float), - ys: array(float), - }; - - let toJs = (t: t) => { - {"xs": t.xs, "ys": t.ys}; - }; - - let toComponentsDist = (d: t): ForetoldComponents.Types.Dist.t => { - xs: d.xs, - ys: d.ys, - }; - - type pdf = t; - type cdf = t; -}; - -module DiscreteDistribution = { - type t = { - xs: array(float), - ys: array(float), - }; - - let fromArray = (xs, ys) => {xs, ys}; - - let _lastElement = (a: array('a)) => - switch (Belt.Array.size(a)) { - | 0 => None - | n => Belt.Array.get(a, n) - }; - - let derivative = (p: t) => { - let (xs, ys) = - Belt.Array.zip(p.xs, p.ys) - ->Belt.Array.reduce([||], (items, (x, y)) => - switch (_lastElement(items)) { - | Some((_, yLast)) => [|(x, y -. yLast)|] - | None => [|(x, y)|] - } - ) - |> Belt.Array.unzip; - fromArray(xs, ys); - }; - - let integral = (p: t) => { - let (xs, ys) = - Belt.Array.zip(p.xs, p.ys) - ->Belt.Array.reduce([||], (items, (x, y)) => - switch (_lastElement(items)) { - | Some((_, yLast)) => [|(x, y +. yLast)|] - | None => [|(x, y)|] - } - ) - |> Belt.Array.unzip; - fromArray(xs, ys); - }; -}; - -module MixedDistribution = { - type t = { - discrete: DiscreteDistribution.t, - continuous: ContinuousDistribution.t, - }; -}; \ No newline at end of file diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 4e9dbc87..2caf295c 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -129,15 +129,7 @@ module Model = { (), ); Prop.Value.GenericDistribution(genericDistribution); - | CHANCE_OF_EXISTENCE => - let lazyDistribution = r => - TimeLimitedDomainCdf.make( - ~timeVector={zero: currentDateTime, unit: `years}, - ~distribution=r(FloatCdf.logNormal(10., 2.)), - ~probabilityAtMaxX=0.7, - ~maxX=`x(200.), - ); - Prop.Value.TimeLimitedDomainCdfLazy(lazyDistribution); + | CHANCE_OF_EXISTENCE => Prop.Value.Probability(0.3) }; }; }; diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 1f62dc49..d405758a 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,10 +1,9 @@ -// ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), +// ~generationSource=GuesstimatorString(, module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { let genericDistribution = GenericDistribution.make( - ~generationSource= - GuesstimatorString("mm(floor(10 to 15), 20 to 30, [.5,.5])"), + ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), ~probabilityType=Cdf, ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), ~unit=Time({zero: currentDateTime, unit: `years}), diff --git a/src/utility/Guesstimator.re b/src/utility/Guesstimator.re index 560ca798..c6ba158e 100644 --- a/src/utility/Guesstimator.re +++ b/src/utility/Guesstimator.re @@ -25,12 +25,12 @@ module Internals = { external toCombinedFormat: (string, int) => combined = "run"; let toMixedShape = (r: combined): option(DistributionTypes.mixedShape) => { - let assumptions: Shape.Mixed.Builder.assumptions = { + let assumptions: MixedShapeBuilder.assumptions = { continuous: ADDS_TO_1, discrete: ADDS_TO_CORRECT_PROBABILITY, discreteProbabilityMass: None, }; - Shape.Mixed.Builder.build( + MixedShapeBuilder.build( ~continuous=toContinous(r), ~discrete=toDiscrete(r), ~assumptions, From d71d15774177fb025f6f7cb34c361710ae327547 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 16 Feb 2020 12:14:08 +0000 Subject: [PATCH 20/28] Minor restructuring --- src/{Experimental => _obsolete}/LimitedDomainCdf.re | 0 src/{Experimental => _obsolete}/OldFormWithTable.re | 0 src/{Experimental => _obsolete}/Test1.re | 0 src/{Experimental => _obsolete}/Test2.re | 0 src/{Experimental => _obsolete}/TimeLimitedDomainCdf.re | 0 src/{lib => core}/DistributionTypes.re | 2 +- src/{lib => core}/GenericDistribution.re | 0 src/{lib => core}/MixedShapeBuilder.re | 0 src/{lib => core}/Shape.re | 0 src/{lib => core}/TimeTypes.re | 0 src/{lib => interface}/FormBuilder.re | 0 src/{lib => interface}/Prop.re | 0 src/{lib => interface}/ValueForm.re | 0 src/lib/Types.re | 0 src/utility/GuesstimatorLibrary3.re | 2 -- 15 files changed, 1 insertion(+), 3 deletions(-) rename src/{Experimental => _obsolete}/LimitedDomainCdf.re (100%) rename src/{Experimental => _obsolete}/OldFormWithTable.re (100%) rename src/{Experimental => _obsolete}/Test1.re (100%) rename src/{Experimental => _obsolete}/Test2.re (100%) rename src/{Experimental => _obsolete}/TimeLimitedDomainCdf.re (100%) rename src/{lib => core}/DistributionTypes.re (99%) rename src/{lib => core}/GenericDistribution.re (100%) rename src/{lib => core}/MixedShapeBuilder.re (100%) rename src/{lib => core}/Shape.re (100%) rename src/{lib => core}/TimeTypes.re (100%) rename src/{lib => interface}/FormBuilder.re (100%) rename src/{lib => interface}/Prop.re (100%) rename src/{lib => interface}/ValueForm.re (100%) delete mode 100644 src/lib/Types.re delete mode 100644 src/utility/GuesstimatorLibrary3.re diff --git a/src/Experimental/LimitedDomainCdf.re b/src/_obsolete/LimitedDomainCdf.re similarity index 100% rename from src/Experimental/LimitedDomainCdf.re rename to src/_obsolete/LimitedDomainCdf.re diff --git a/src/Experimental/OldFormWithTable.re b/src/_obsolete/OldFormWithTable.re similarity index 100% rename from src/Experimental/OldFormWithTable.re rename to src/_obsolete/OldFormWithTable.re diff --git a/src/Experimental/Test1.re b/src/_obsolete/Test1.re similarity index 100% rename from src/Experimental/Test1.re rename to src/_obsolete/Test1.re diff --git a/src/Experimental/Test2.re b/src/_obsolete/Test2.re similarity index 100% rename from src/Experimental/Test2.re rename to src/_obsolete/Test2.re diff --git a/src/Experimental/TimeLimitedDomainCdf.re b/src/_obsolete/TimeLimitedDomainCdf.re similarity index 100% rename from src/Experimental/TimeLimitedDomainCdf.re rename to src/_obsolete/TimeLimitedDomainCdf.re diff --git a/src/lib/DistributionTypes.re b/src/core/DistributionTypes.re similarity index 99% rename from src/lib/DistributionTypes.re rename to src/core/DistributionTypes.re index c8b4db27..d19070df 100644 --- a/src/lib/DistributionTypes.re +++ b/src/core/DistributionTypes.re @@ -13,8 +13,8 @@ type xyShape = { xs: array(float), ys: array(float), }; -type continuousShape = xyShape; +type continuousShape = xyShape; type discreteShape = xyShape; type mixedShape = { diff --git a/src/lib/GenericDistribution.re b/src/core/GenericDistribution.re similarity index 100% rename from src/lib/GenericDistribution.re rename to src/core/GenericDistribution.re diff --git a/src/lib/MixedShapeBuilder.re b/src/core/MixedShapeBuilder.re similarity index 100% rename from src/lib/MixedShapeBuilder.re rename to src/core/MixedShapeBuilder.re diff --git a/src/lib/Shape.re b/src/core/Shape.re similarity index 100% rename from src/lib/Shape.re rename to src/core/Shape.re diff --git a/src/lib/TimeTypes.re b/src/core/TimeTypes.re similarity index 100% rename from src/lib/TimeTypes.re rename to src/core/TimeTypes.re diff --git a/src/lib/FormBuilder.re b/src/interface/FormBuilder.re similarity index 100% rename from src/lib/FormBuilder.re rename to src/interface/FormBuilder.re diff --git a/src/lib/Prop.re b/src/interface/Prop.re similarity index 100% rename from src/lib/Prop.re rename to src/interface/Prop.re diff --git a/src/lib/ValueForm.re b/src/interface/ValueForm.re similarity index 100% rename from src/lib/ValueForm.re rename to src/interface/ValueForm.re diff --git a/src/lib/Types.re b/src/lib/Types.re deleted file mode 100644 index e69de29b..00000000 diff --git a/src/utility/GuesstimatorLibrary3.re b/src/utility/GuesstimatorLibrary3.re deleted file mode 100644 index b5c62dda..00000000 --- a/src/utility/GuesstimatorLibrary3.re +++ /dev/null @@ -1,2 +0,0 @@ -// [@bs.module "./GuesstimatorLibrary.js"] - /* external toGuesstimator: (string, int) => CdfLibrary.JS.distJs = "run"*/ \ No newline at end of file From c6727c40a55a815acc1b24c5cd4daeaef3c5683a Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 16 Feb 2020 12:27:44 +0000 Subject: [PATCH 21/28] FloatCdf -> GuesstimatorDist --- src/_obsolete/Test2.re | 10 +++++++--- src/lib/{FloatCdf.re => GuesstimatorDist.re} | 0 src/models/EAFunds.re | 2 +- src/models/GlobalCatastrophe.re | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) rename src/lib/{FloatCdf.re => GuesstimatorDist.re} (100%) diff --git a/src/_obsolete/Test2.re b/src/_obsolete/Test2.re index 6a2ee56e..9303a7e8 100644 --- a/src/_obsolete/Test2.re +++ b/src/_obsolete/Test2.re @@ -27,7 +27,7 @@ type otherSettings = {currentYear: int}; let sharesOutstanding = (price, marketCap) => switch (price, marketCap) { | (Some(price), Some(marketCap)) => - Some(FloatCdf.divide(marketCap, price)) + Some(GuesstimatorDist.divide(marketCap, price)) | _ => None }; @@ -42,11 +42,15 @@ let rec run = | (SHARE_PRICE, year, Some(price), _) when year > 2019 && year < 2030 => let diffYears = year - otherSettings.currentYear; let diffPerYear = 0.1; - Some(FloatCdf.normal(price, float_of_int(diffYears) *. diffPerYear)); + Some( + GuesstimatorDist.normal(price, float_of_int(diffYears) *. diffPerYear), + ); | (MARKET_CAP, year, _, Some(price)) when year > 2019 && year < 2030 => let diffYears = year - otherSettings.currentYear; let diffPerYear = 0.1; - Some(FloatCdf.normal(price, float_of_int(diffYears) *. diffPerYear)); + Some( + GuesstimatorDist.normal(price, float_of_int(diffYears) *. diffPerYear), + ); | (SHARES_OUTSTANDING, year, _, _) when year > 2019 && year < 2030 => let price = run(company, year, SHARE_PRICE, otherSettings); let marketCap = run(company, year, MARKET_CAP, otherSettings); diff --git a/src/lib/FloatCdf.re b/src/lib/GuesstimatorDist.re similarity index 100% rename from src/lib/FloatCdf.re rename to src/lib/GuesstimatorDist.re diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 2caf295c..5edb0497 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -78,7 +78,7 @@ module Model = { let yearDiff = MomentRe.diff(dateTime, currentDateTime, `days) /. 365.; let meanDiff = Js.Math.pow_float(~base=y.meanDiff, ~exp=yearDiff); let stdDevDiff = Js.Math.pow_float(~base=y.meanDiff, ~exp=yearDiff); - FloatCdf.logNormal( + GuesstimatorDist.logNormal( currentValue *. meanDiff, firstYearStdDev *. stdDevDiff, ); diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index d405758a..8644cfb8 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,9 +1,9 @@ -// ~generationSource=GuesstimatorString(, module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { let genericDistribution = GenericDistribution.make( - ~generationSource=GuesstimatorString(FloatCdf.logNormal(20., 3.)), + ~generationSource= + GuesstimatorString(GuesstimatorDist.logNormal(20., 3.)), ~probabilityType=Cdf, ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), ~unit=Time({zero: currentDateTime, unit: `years}), From 294965a19ae6f97c7f782829dc35a4c3ea11e697 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 09:21:15 +0000 Subject: [PATCH 22/28] Minor touch-ups --- src/core/Shape.re | 7 +++++++ src/interface/ValueForm.re | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/Shape.re b/src/core/Shape.re index a0a90b5c..0beb09a2 100644 --- a/src/core/Shape.re +++ b/src/core/Shape.re @@ -84,4 +84,11 @@ module Mixed = { discrete, discreteProbabilityMassFraction, }; +}; + +module DomainMixed = { + type t = { + mixedShape, + domain, + }; }; \ No newline at end of file diff --git a/src/interface/ValueForm.re b/src/interface/ValueForm.re index 11f19015..18cfe416 100644 --- a/src/interface/ValueForm.re +++ b/src/interface/ValueForm.re @@ -49,7 +49,7 @@ let make = ) }> {r.name |> ReasonReact.string} - {(r.truthValue ? "TRUE" : "FALSE") |> ReasonReact.string} + {(r.truthValue ? " = True" : " = False") |> ReasonReact.string}
) |> ReasonReact.array} @@ -77,7 +77,7 @@ let make = ); (); }}> - {"True" |> ReasonReact.string} + {"=True" |> ReasonReact.string}
) From d034e2a96f4b8d78dd24970b74145b1d1ae4ae0d Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 09:59:33 +0000 Subject: [PATCH 23/28] Initial valueCluster setup --- src/interface/FormBuilder.re | 35 ++++++++- src/interface/Prop.re | 148 ++++++++++++++++++++--------------- src/interface/ValueForm.re | 30 ------- 3 files changed, 117 insertions(+), 96 deletions(-) diff --git a/src/interface/FormBuilder.re b/src/interface/FormBuilder.re index 0777efe1..bac1b955 100644 --- a/src/interface/FormBuilder.re +++ b/src/interface/FormBuilder.re @@ -13,6 +13,39 @@ let makeHelpers = (combo): formState => { {combo, setCombo, setInputValue}; }; +let propValue = (t: Prop.Value.t) => { + switch (t) { + | SelectSingle(r) => r |> ReasonReact.string + | ConditionalArray(r) => "Array" |> ReasonReact.string + | GenericDistribution(r) => + let newDistribution = + GenericDistribution.renderIfNeeded(~sampleCount=1000, r); + switch (newDistribution) { + | Some({ + generationSource: + Shape( + Mixed({ + continuous: n, + discrete: d, + discreteProbabilityMassFraction: f, + }), + ), + }) => +
+ Shape.Continuous.toJs} /> + {d |> Shape.Discrete.scaleYToTotal(f) |> Shape.Discrete.render} +
+ | None => "Something went wrong" |> ReasonReact.string + | _ =>
+ }; + | FloatCdf(_) =>
+ | Probability(r) => + (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string + | DateTime(r) => r |> MomentRe.Moment.defaultFormat |> ReasonReact.string + | FloatPoint(r) => r |> Js.Float.toFixed |> ReasonReact.string + }; +}; + module ModelForm = { let handleChange = (handleChange, event) => handleChange(ReactEvent.Form.target(event)##value); @@ -51,7 +84,7 @@ module ModelForm = { ) |> ReasonReact.array}
- {model.run(formState.combo) |> E.O.React.fmapOrNull(Value.display)} + {model.run(formState.combo) |> E.O.React.fmapOrNull(propValue)}
; diff --git a/src/interface/Prop.re b/src/interface/Prop.re index 92827695..90766b0c 100644 --- a/src/interface/Prop.re +++ b/src/interface/Prop.re @@ -1,84 +1,88 @@ module Value = { - type binaryConditional = - | Selected(bool) - | Unselected; - type conditional = { name: string, truthValue: bool, }; type t = - | BinaryConditional(binaryConditional) | SelectSingle(string) | DateTime(MomentRe.Moment.t) | FloatPoint(float) | Probability(float) - | Conditional(conditional) | GenericDistribution(DistributionTypes.genericDistribution) | ConditionalArray(array(conditional)) | FloatCdf(string); +}; - let to_string = (t: t) => { - switch (t) { - | BinaryConditional(binaryConditional) => - switch (binaryConditional) { - | Selected(r) => r ? "True" : "False" - | Unselected => "" - } - | SelectSingle(r) => r - | FloatCdf(r) => r - | GenericDistribution(_) => "" - | Probability(r) => (r *. 100. |> Js.Float.toFixed) ++ "%" - | DateTime(r) => r |> MomentRe.Moment.defaultFormat - | FloatPoint(r) => r |> Js.Float.toFixed - | Conditional(r) => r.name - | ConditionalArray(r) => - r |> E.A.fmap(r => r.name) |> Js.Array.joinWith(",") - }; +module ValueCombination = { + type pointsToEvenlySample = int; + + type dateTimeRange = { + startTime: MomentRe.Moment.t, + endTime: MomentRe.Moment.t, + pointsWithin: int, }; - let display = (t: t) => { - switch (t) { - | BinaryConditional(binaryConditional) => - ( - switch (binaryConditional) { - | Selected(r) => r ? "True" : "False" - | Unselected => "" - } + type floatPointRange = { + startTime: float, + endTime: float, + pointsWithin: int, + }; + + type range('a) = { + beginning: 'a, + ending: 'a, + pointsToEvenlySample, + }; + + type t = + | SelectSingle + | DateTime(range(MomentRe.Moment.t)) + | FloatPoint(range(MomentRe.Moment.t)) + | Probability(pointsToEvenlySample); +}; + +module ValueCluster = { + type conditional = { + name: string, + truthValue: bool, + }; + + type pointsToEvenlySample = int; + + type dateTimeRange = { + startTime: MomentRe.Moment.t, + endTime: MomentRe.Moment.t, + pointsWithin: int, + }; + + type floatPointRange = { + startTime: float, + endTime: float, + pointsWithin: int, + }; + + type range('a) = { + beginning: 'a, + ending: 'a, + pointsToEvenlySample, + }; + + type t = + | SelectSingle([ | `combination | `item(string)]) + | DateTime( + [ + | `combination(range(MomentRe.Moment.t)) + | `item(MomentRe.Moment.t) + ], ) - |> ReasonReact.string - | SelectSingle(r) => r |> ReasonReact.string - | ConditionalArray(r) => "Array" |> ReasonReact.string - | Conditional(r) => r.name |> ReasonReact.string - | GenericDistribution(r) => - let newDistribution = - GenericDistribution.renderIfNeeded(~sampleCount=1000, r); - switch (newDistribution) { - | Some({ - generationSource: - Shape( - Mixed({ - continuous: n, - discrete: d, - discreteProbabilityMassFraction: f, - }), - ), - }) => -
- Shape.Continuous.toJs} /> - {d |> Shape.Discrete.scaleYToTotal(f) |> Shape.Discrete.render} -
- | None => "Something went wrong" |> ReasonReact.string - | _ =>
- }; - | FloatCdf(_) =>
- | Probability(r) => - (r *. 100. |> Js.Float.toFixed) ++ "%" |> ReasonReact.string - | DateTime(r) => r |> MomentRe.Moment.defaultFormat |> ReasonReact.string - | FloatPoint(r) => r |> Js.Float.toFixed |> ReasonReact.string - }; - }; + | FloatPoint( + [ | `combination(range(MomentRe.Moment.t)) | `item(string)], + ) + | Probability([ | `item(string)]) + | GenericDistribution([ | `item(DistributionTypes.genericDistribution)]) + | ConditionalArray([ | `item(array(conditional))]) + | FloatCdf([ | `item(string)]); }; module Type = { @@ -113,7 +117,6 @@ module Type = { type withDefault('a) = {default: option('a)}; type t = - | BinaryConditional | SelectSingle(selectSingle) | FloatPoint(withDefaultMinMax(float)) | Probability(withDefault(float)) @@ -124,7 +127,6 @@ module Type = { let default = (t: t) => switch (t) { - | BinaryConditional => Some(Value.BinaryConditional(Unselected)) | Conditionals(s) => Some(Value.ConditionalArray(s.defaults)) | Year(r) => r.default->Belt.Option.map(p => Value.FloatPoint(p)) | FloatPoint(r) => r.default->Belt.Option.map(p => Value.FloatPoint(p)) @@ -152,6 +154,22 @@ module ValueMap = { let fromOptionalArray = (r): t => MS.fromArray(r) |> fromOptionalMap; }; +module ValueClusterMap = { + module MS = Belt.Map.String; + type t = MS.t(ValueCluster.t); + let get = (t: t, s) => MS.get(t, s); + let keys = MS.keysToArray; + let map = MS.map; + let fromArray = (r): t => MS.fromArray(r); + let values = (t: t) => t |> MS.valuesToArray; + let update = (t, k, v) => MS.update(t, k, _ => v); + let toArray = MS.toArray; + let fromOptionalMap = (t: MS.t(option(ValueCluster.t))): t => + MS.keep(t, (_, d) => E.O.isSome(d)) + ->MS.map(d => E.O.toExn("This should not have happened", d)); + let fromOptionalArray = (r): t => MS.fromArray(r) |> fromOptionalMap; +}; + module TypeWithMetadata = { // TODO: Figure out a better name for assumptionType type assumptionType = diff --git a/src/interface/ValueForm.re b/src/interface/ValueForm.re index 18cfe416..2d746a20 100644 --- a/src/interface/ValueForm.re +++ b/src/interface/ValueForm.re @@ -127,36 +127,6 @@ let make = } )} /> - | (BinaryConditional, Some(BinaryConditional(r))) => - switch (r) { - | Unselected => -
onChange(Some(BinaryConditional(Selected(true))))}> - {"Select" |> ReasonReact.string} -
- | Selected(true) => -
- {"YES!" |> ReasonReact.string} -
onChange(Some(BinaryConditional(Selected(false))))}> - {"No" |> ReasonReact.string} -
-
onChange(Some(BinaryConditional(Unselected)))}> - {"Deselect" |> ReasonReact.string} -
-
- | Selected(false) => -
- {"NO!" |> ReasonReact.string} -
onChange(Some(BinaryConditional(Selected(true))))}> - {"Yes" |> ReasonReact.string} -
-
onChange(Some(BinaryConditional(Unselected)))}> - {"Deselect" |> ReasonReact.string} -
-
- } | (Year(_), _) | (FloatPoint(_), _) => | (SelectSingle(t), Some(SelectSingle(r))) => From 1a547748c70ed40c1a7e079488f98a70c6bf00e7 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 16:53:30 +0000 Subject: [PATCH 24/28] Minor cleanup --- src/interface/FormBuilder.re | 3 ++- src/interface/Prop.re | 9 ++++++--- src/models/EAFunds.re | 4 ++-- src/models/GlobalCatastrophe.re | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/interface/FormBuilder.re b/src/interface/FormBuilder.re index bac1b955..377e902b 100644 --- a/src/interface/FormBuilder.re +++ b/src/interface/FormBuilder.re @@ -84,7 +84,8 @@ module ModelForm = { ) |> ReasonReact.array}
- {model.run(formState.combo) |> E.O.React.fmapOrNull(propValue)} + {model.run(Prop.Combo.InputValues.toValueArray(formState.combo)) + |> E.O.React.fmapOrNull(propValue)}
; diff --git a/src/interface/Prop.re b/src/interface/Prop.re index 90766b0c..61865d46 100644 --- a/src/interface/Prop.re +++ b/src/interface/Prop.re @@ -226,7 +226,7 @@ module Model = { version: string, inputTypes: array(TypeWithMetadata.t), outputTypes: array(TypeWithMetadata.t), - run: combo => option(Value.t), + run: array(option(Value.t)) => option(Value.t), } and combo = { model: t, @@ -237,11 +237,14 @@ module Model = { module InputTypes = { let keys = (t: t) => t.inputTypes |> E.A.fmap((r: TypeWithMetadata.t) => r.id); + + let getBy = (t: t, fn) => t.inputTypes |> E.A.getBy(_, fn); }; }; module Combo = { type t = Model.combo; + type valueArray = array(option(Value.t)); module InputValues = { let defaults = (t: Model.t) => @@ -258,10 +261,10 @@ module Combo = { let update = (t: t, key: string, onUpdate: option(Value.t)) => ValueMap.update(t.inputValues, key, onUpdate); - let toValueArray = (t: t) => { + let toValueArray = (t: t): valueArray => { t.model.inputTypes |> E.A.fmap((r: TypeWithMetadata.t) => - ValueMap.get(t.inputValues, r.id) + t.inputValues->ValueMap.get(r.id) ); }; }; diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 5edb0497..0c75ae31 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -151,8 +151,8 @@ module Interface = { | _ => PAYOUTS }; - let run = (p: Prop.Combo.t) => { - switch (Prop.Combo.InputValues.toValueArray(p)) { + let run = (p: array(option(Prop.Value.t))) => { + switch (p) { | [| Some(SelectSingle(fund)), Some(DateTime(intendedYear)), diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index 8644cfb8..b21d73ff 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -16,8 +16,8 @@ module Model = { module Interface = { let dayKey = "Day"; - let run = (p: Prop.Combo.t) => { - switch (Prop.Combo.InputValues.toValueArray(p)) { + let run = (p: array(option(Prop.Value.t))) => { + switch (p) { | [|Some(DateTime(currentYear))|] => Some(Model.make(currentYear)) | _ => None }; From 17e40a909875f8c1a0dbb826800293878fc3aac5 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 19:45:32 +0000 Subject: [PATCH 25/28] Minor cleanup --- src/core/MixedCdf.re | 15 +++++++++++++ src/core/Shape.re | 14 +++++++++++- src/interface/Prop.re | 5 +++++ src/lib/GuesstimatorDist.re | 3 ++- src/models/EAFunds.re | 40 ++++++++++++++++++++++++++++----- src/models/GlobalCatastrophe.re | 5 +++-- 6 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 src/core/MixedCdf.re diff --git a/src/core/MixedCdf.re b/src/core/MixedCdf.re new file mode 100644 index 00000000..8ffb7b31 --- /dev/null +++ b/src/core/MixedCdf.re @@ -0,0 +1,15 @@ +type t = DistributionTypes.mixedShape; + +type yPdfPoint = { + continuous: float, + discrete: float, +}; + +let getY = (t: t, x: float): yPdfPoint => { + continuous: Shape.Continuous.findY(x, t.continuous), + discrete: Shape.Discrete.findY(x, t.discrete), +} /* }*/; + +// let getIntegralY = (t: t, x: float): float => { +// continuous: Shape.Continuous.findY(x, t.continuous), +// discrete: Shape.Discrete.findY(x, t.discrete), \ No newline at end of file diff --git a/src/core/Shape.re b/src/core/Shape.re index 0beb09a2..507e05a7 100644 --- a/src/core/Shape.re +++ b/src/core/Shape.re @@ -14,9 +14,11 @@ module XYShape = { }; let fmap = (t: t, y): t => {xs: t.xs, ys: t.ys |> E.A.fmap(y)}; + let yFold = (fn, t: t) => { E.A.fold_left(fn, 0., t.ys); }; + let ySum = yFold((a, b) => a +. b); let fromArrays = (xs, ys): t => {xs, ys}; @@ -34,8 +36,8 @@ module XYShape = { fromArrays(xs, ys); }; - let derivative = transverse((aCurrent, aLast) => aCurrent -. aLast); let integral = transverse((aCurrent, aLast) => aCurrent +. aLast); + let derivative = transverse((aCurrent, aLast) => aCurrent -. aLast); }; module Continuous = { @@ -84,6 +86,16 @@ module Mixed = { discrete, discreteProbabilityMassFraction, }; + + type yPdfPoint = { + continuous: float, + discrete: float, + }; + + let getY = (t: DistributionTypes.mixedShape, x: float): yPdfPoint => { + continuous: Continuous.findY(x, t.continuous), + discrete: Discrete.findY(x, t.discrete), + }; }; module DomainMixed = { diff --git a/src/interface/Prop.re b/src/interface/Prop.re index 61865d46..c2a33e23 100644 --- a/src/interface/Prop.re +++ b/src/interface/Prop.re @@ -12,6 +12,11 @@ module Value = { | GenericDistribution(DistributionTypes.genericDistribution) | ConditionalArray(array(conditional)) | FloatCdf(string); + + module ConditionalArray = { + let get = (conditionals: array(conditional), name: string) => + Belt.Array.getBy(conditionals, (c: conditional) => c.name == name); + }; }; module ValueCombination = { diff --git a/src/lib/GuesstimatorDist.re b/src/lib/GuesstimatorDist.re index dea45fb4..74f54e50 100644 --- a/src/lib/GuesstimatorDist.re +++ b/src/lib/GuesstimatorDist.re @@ -17,4 +17,5 @@ let logNormal = (mean: float, std: float) => { ); }; -let divide = (str1: string, str2: string) => {j|$(str1)/$(str2)|j}; \ No newline at end of file +let divide = (str1: string, str2: string) => {j|$(str1)/$(str2)|j}; +let min = (str1: string, str2: string) => {j|min($(str1),$(str2))|j}; \ No newline at end of file diff --git a/src/models/EAFunds.re b/src/models/EAFunds.re index 0c75ae31..f498fb32 100644 --- a/src/models/EAFunds.re +++ b/src/models/EAFunds.re @@ -103,13 +103,19 @@ module Model = { | (_, CHANCE_OF_EXISTENCE) => 0.0 }; }; + + let xRisk = conditionals => + Prop.Value.ConditionalArray.get(conditionals, "Global Existential Event"); + let make = ( group: group, dateTime: MomentRe.Moment.t, currentDateTime: MomentRe.Moment.t, output: output, + conditionals: array(Prop.Value.conditional), ) => { + let xRisk = xRisk(conditionals); switch (output) { | DONATIONS | PAYOUTS => @@ -120,16 +126,37 @@ module Model = { currentDateTime, yearlyMeanGrowthRateIfNotClosed(group), ); + let str = + switch (xRisk) { + | Some({truthValue: true}) => "0" + | Some({truthValue: false}) => difference + | None => "uniform(0,1) > .3 ? " ++ difference ++ ": 0" + }; let genericDistribution = GenericDistribution.make( - ~generationSource=GuesstimatorString(difference), + ~generationSource=GuesstimatorString(str), ~probabilityType=Cdf, ~domain=Complete, ~unit=Unspecified, (), ); Prop.Value.GenericDistribution(genericDistribution); - | CHANCE_OF_EXISTENCE => Prop.Value.Probability(0.3) + | CHANCE_OF_EXISTENCE => + Prop.Value.GenericDistribution( + GenericDistribution.make( + ~generationSource= + GuesstimatorString( + GuesstimatorDist.min( + GlobalCatastrophe.guesstimatorString, + GuesstimatorDist.logNormal(40., 4.), + ), + ), + ~probabilityType=Cdf, + ~domain=RightLimited({xPoint: 100., excludingProbabilityMass: 0.3}), + ~unit=Time({zero: currentDateTime, unit: `years}), + (), + ), + ) }; }; }; @@ -158,7 +185,7 @@ module Interface = { Some(DateTime(intendedYear)), Some(DateTime(currentYear)), Some(SelectSingle(output)), - _, + Some(ConditionalArray(conditionals)), |] => choiceFromString(fund) |> E.O.fmap(fund => @@ -167,6 +194,7 @@ module Interface = { intendedYear, currentYear, outputFromString(output), + conditionals, ) ) | _ => None @@ -229,9 +257,9 @@ module Interface = { SelectSingle({ default: Some("Output"), options: [ - {name: "Donations | Exists", id: "donations"}, - {name: "Funding | Exists", id: "funding"}, - {name: "Exists", id: "exists"}, + {name: "Donations", id: "donations"}, + {name: "Funding", id: "funding"}, + {name: "Closing", id: "exists"}, ], }), (), diff --git a/src/models/GlobalCatastrophe.re b/src/models/GlobalCatastrophe.re index b21d73ff..bd29b03c 100644 --- a/src/models/GlobalCatastrophe.re +++ b/src/models/GlobalCatastrophe.re @@ -1,9 +1,10 @@ +let guesstimatorString = GuesstimatorDist.logNormal(20., 3.); + module Model = { let make = (currentDateTime: MomentRe.Moment.t) => { let genericDistribution = GenericDistribution.make( - ~generationSource= - GuesstimatorString(GuesstimatorDist.logNormal(20., 3.)), + ~generationSource=GuesstimatorString(guesstimatorString), ~probabilityType=Cdf, ~domain=RightLimited({xPoint: 200., excludingProbabilityMass: 0.3}), ~unit=Time({zero: currentDateTime, unit: `years}), From 17071602e82c75b4c14e91eb71040eba3d064c93 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 21:52:21 +0000 Subject: [PATCH 26/28] Added simple showcase, related components --- bsconfig.json | 14 +- package.json | 2 + showcase/Entries.re | 1 + showcase/EntryTypes.re | 30 +++ showcase/Lib.re | 200 +++++++++++++++ showcase/ShowcaseIndex.re | 2 + showcase/entries/Continuous.re | 19 ++ showcase/index.html | 23 ++ src/components/charts/CdfChart__Base.re | 43 ++++ src/components/charts/CdfChart__Plain.re | 41 +++ src/components/charts/ChartSimple.re | 24 ++ src/components/charts/ChartWithNumber.re | 23 ++ src/components/charts/cdfChartReact.js | 66 +++++ src/components/charts/cdfChartd3.js | 302 +++++++++++++++++++++++ src/core/MixedCdf.re | 5 +- src/core/Shape.re | 5 +- src/utility/CdfLibrary.js | 1 + src/utility/CdfLibrary.re | 2 +- yarn.lock | 37 +++ 19 files changed, 830 insertions(+), 10 deletions(-) create mode 100644 showcase/Entries.re create mode 100644 showcase/EntryTypes.re create mode 100644 showcase/Lib.re create mode 100644 showcase/ShowcaseIndex.re create mode 100644 showcase/entries/Continuous.re create mode 100644 showcase/index.html create mode 100644 src/components/charts/CdfChart__Base.re create mode 100644 src/components/charts/CdfChart__Plain.re create mode 100644 src/components/charts/ChartSimple.re create mode 100644 src/components/charts/ChartWithNumber.re create mode 100644 src/components/charts/cdfChartReact.js create mode 100644 src/components/charts/cdfChartd3.js diff --git a/bsconfig.json b/bsconfig.json index 359646a4..81ef6fe0 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -3,10 +3,16 @@ "reason": { "react-jsx": 3 }, - "sources": { - "dir": "src", - "subdirs": true - }, + "sources": [{ + "dir": "src", + "subdirs": true + }, + { + "dir": "showcase", + "type": "dev", + "subdirs": true + } + ], "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"], "package-specs": [{ "module": "commonjs", diff --git a/package.json b/package.json index 90305344..59806ab0 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "clean": "bsb -clean-world", "parcel": "parcel ./src/index.html --public-url / --no-autoinstall -- watch", "parcel-build": "parcel build ./src/index.html --no-source-maps --no-autoinstall", + "showcase": "PORT=12345 parcel showcase/index.html", "server": "moduleserve ./ --port 8000", "predeploy": "parcel build ./src/index.html --no-source-maps --no-autoinstall", "deploy": "gh-pages -d dist", @@ -31,6 +32,7 @@ "bs-css": "^11.0.0", "bs-moment": "0.4.4", "bs-reform": "9.7.1", + "d3": "^5.15.0", "lenses-ppx": "4.0.0", "less": "^3.10.3", "lodash": "^4.17.15", diff --git a/showcase/Entries.re b/showcase/Entries.re new file mode 100644 index 00000000..ae4cef64 --- /dev/null +++ b/showcase/Entries.re @@ -0,0 +1 @@ +let entries = EntryTypes.[Continuous.entry]; \ No newline at end of file diff --git a/showcase/EntryTypes.re b/showcase/EntryTypes.re new file mode 100644 index 00000000..49a61a33 --- /dev/null +++ b/showcase/EntryTypes.re @@ -0,0 +1,30 @@ +type compEntry = { + mutable id: string, + title: string, + render: unit => React.element, + container: containerType, +} +and folderEntry = { + mutable id: string, + title: string, + children: list(navEntry), +} +and navEntry = + | CompEntry(compEntry) + | FolderEntry(folderEntry) +and containerType = + | FullWidth + | Sidebar; + +let entry = (~title, ~render): navEntry => { + CompEntry({id: "", title, render, container: FullWidth}); +}; + +// Maybe different api, this avoids breaking changes +let sidebar = (~title, ~render): navEntry => { + CompEntry({id: "", title, render, container: Sidebar}); +}; + +let folder = (~title, ~children): navEntry => { + FolderEntry({id: "", title, children}); +}; diff --git a/showcase/Lib.re b/showcase/Lib.re new file mode 100644 index 00000000..60c27f79 --- /dev/null +++ b/showcase/Lib.re @@ -0,0 +1,200 @@ +open EntryTypes; + +module HS = Belt.HashMap.String; + +let entriesByPath: HS.t(navEntry) = HS.make(~hintSize=100); + +/* Creates unique id's per scope based on title */ +let buildIds = entries => { + let genId = (title, path) => { + let noSpaces = Js.String.replaceByRe([%bs.re "/\\s+/g"], "-", title); + if (!HS.has(entriesByPath, path ++ "/" ++ noSpaces)) { + noSpaces; + } else { + let rec loop = num => { + let testId = noSpaces ++ "-" ++ string_of_int(num); + if (!HS.has(entriesByPath, path ++ "/" ++ testId)) { + testId; + } else { + loop(num + 1); + }; + }; + loop(2); + }; + }; + let rec processFolder = (f: folderEntry, curPath) => { + f.id = curPath ++ "/" ++ genId(f.title, curPath); + HS.set(entriesByPath, f.id, FolderEntry(f)); + f.children + |> E.L.iter(e => + switch (e) { + | CompEntry(c) => processEntry(c, f.id) + | FolderEntry(f) => processFolder(f, f.id) + } + ); + } + and processEntry = (c: compEntry, curPath) => { + c.id = curPath ++ "/" ++ genId(c.title, curPath); + HS.set(entriesByPath, c.id, CompEntry(c)); + }; + entries + |> E.L.iter(e => + switch (e) { + | CompEntry(c) => processEntry(c, "") + | FolderEntry(f) => processFolder(f, "") + } + ); +}; + +let entries = Entries.entries; +buildIds(entries); + +module Styles = { + open Css; + let pageContainer = style([display(`flex), height(`vh(100.))]); + let leftNav = + style([ + padding(`em(2.)), + flexBasis(`px(200)), + flexShrink(0.), + backgroundColor(`hex("eaeff3")), + boxShadows([ + Shadow.box( + ~x=px(-1), + ~blur=px(1), + ~inset=true, + rgba(0, 0, 0, 0.1), + ), + ]), + ]); + + let folderNav = + style([ + selector( + ">h4", + [ + cursor(`pointer), + margin2(~v=`em(0.3), ~h=`zero), + hover([color(`hex("7089ad"))]), + ], + ), + ]); + let folderChildren = style([paddingLeft(`px(7))]); + let compNav = + style([ + cursor(`pointer), + paddingBottom(`px(3)), + hover([color(`hex("7089ad"))]), + ]); + let compContainer = style([padding(`em(2.)), flexGrow(1.)]); + // Approximate sidebar container for entry + let sidebarContainer = style([maxWidth(`px(430))]); + let folderChildContainer = style([marginBottom(`em(2.))]); +}; + +let baseUrl = "/showcase/index.html"; + +module Index = { + type state = {route: ReasonReactRouter.url}; + + type action = + | ItemClick(string) + | ChangeRoute(ReasonReactRouter.url); + + let changeId = (id: string) => { + ReasonReactRouter.push(baseUrl ++ "#" ++ id); + (); + }; + + let buildNav = setRoute => { + let rec buildFolder = (f: folderEntry) => { +
+

changeId(f.id)}> f.title->React.string

+
+ {( + f.children + |> E.L.fmap(e => + switch (e) { + | FolderEntry(folder) => buildFolder(folder) + | CompEntry(entry) => buildEntry(entry) + } + ) + |> E.L.toArray + ) + ->React.array} +
+
; + } + and buildEntry = (e: compEntry) => { +
changeId(e.id)}> + e.title->React.string +
; + }; + ( + entries + |> E.L.fmap(e => + switch (e) { + | FolderEntry(folder) => buildFolder(folder) + | CompEntry(entry) => buildEntry(entry) + } + ) + |> E.L.toArray + ) + ->React.array; + }; + + let renderEntry = e => { + switch (e.container) { + | FullWidth => e.render() + | Sidebar =>
{e.render()}
+ }; + }; + + [@react.component] + let make = () => { + let (route, setRoute) = + React.useState(() => { + let url: ReasonReactRouter.url = {path: [], hash: "", search: ""}; + url; + }); + + React.useState(() => { + ReasonReactRouter.watchUrl(url => setRoute(_ => url)); + (); + }) + |> ignore; + +
+
{buildNav(setRoute)}
+
+ {if (route.hash == "") { + React.null; + } else { + switch (HS.get(entriesByPath, route.hash)) { + | Some(navEntry) => + switch (navEntry) { + | CompEntry(c) => renderEntry(c) + | FolderEntry(f) => + /* Rendering immediate children */ + ( + f.children + |> E.L.fmap(child => + switch (child) { + | CompEntry(c) => +
+ {renderEntry(c)} +
+ | _ => React.null + } + ) + |> E.L.toArray + ) + ->React.array + } + | None =>
"Component not found"->React.string
+ }; + }} +
+
; + }; +}; \ No newline at end of file diff --git a/showcase/ShowcaseIndex.re b/showcase/ShowcaseIndex.re new file mode 100644 index 00000000..e3912686 --- /dev/null +++ b/showcase/ShowcaseIndex.re @@ -0,0 +1,2 @@ +ReactDOMRe.renderToElementWithId(
, "main"); +ReasonReactRouter.push(""); \ No newline at end of file diff --git a/showcase/entries/Continuous.re b/showcase/entries/Continuous.re new file mode 100644 index 00000000..5475fd92 --- /dev/null +++ b/showcase/entries/Continuous.re @@ -0,0 +1,19 @@ +open ForetoldComponents.Base; + +let data: DistributionTypes.xyShape = { + xs: [|0.2, 20., 80., 212., 330.|], + ys: [|0.0, 0.3, 0.5, 0.2, 0.1|], +}; + +let alerts = () => +
+
+
+ Shape.XYShape.integral} + color={`hex("333")} + /> +
+
; + +let entry = EntryTypes.(entry(~title="Pdf", ~render=alerts)); \ No newline at end of file diff --git a/showcase/index.html b/showcase/index.html new file mode 100644 index 00000000..7879deec --- /dev/null +++ b/showcase/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + Showcase + + + +
+ + + + \ No newline at end of file diff --git a/src/components/charts/CdfChart__Base.re b/src/components/charts/CdfChart__Base.re new file mode 100644 index 00000000..6abb50bc --- /dev/null +++ b/src/components/charts/CdfChart__Base.re @@ -0,0 +1,43 @@ +[@bs.module "./cdfChartReact.js"] +external cdfChart: ReasonReact.reactClass = "default"; + +type primaryDistribution = { + . + "xs": array(float), + "ys": array(float), +}; + +[@react.component] +let make = + ( + ~height=?, + ~verticalLine=?, + ~showVerticalLine=?, + ~marginBottom=?, + ~marginTop=?, + ~showDistributionLines=?, + ~maxX=?, + ~minX=?, + ~onHover=(f: float) => (), + ~primaryDistribution=?, + ~children=[||], + ) => + ReasonReact.wrapJsForReason( + ~reactClass=cdfChart, + ~props= + makeProps( + ~height?, + ~verticalLine?, + ~marginBottom?, + ~marginTop?, + ~onHover, + ~showVerticalLine?, + ~showDistributionLines?, + ~maxX?, + ~minX?, + ~primaryDistribution?, + (), + ), + children, + ) + |> ReasonReact.element; \ No newline at end of file diff --git a/src/components/charts/CdfChart__Plain.re b/src/components/charts/CdfChart__Plain.re new file mode 100644 index 00000000..72067a3e --- /dev/null +++ b/src/components/charts/CdfChart__Plain.re @@ -0,0 +1,41 @@ +module Styles = { + open Css; + let textOverlay = style([position(`absolute)]); + let mainText = style([fontSize(`em(1.1))]); + let secondaryText = style([fontSize(`em(0.9))]); + + let graph = chartColor => + style([ + position(`relative), + selector(".axis", [fontSize(`px(9))]), + selector(".domain", [display(`none)]), + selector(".tick line", [display(`none)]), + selector(".tick text", [color(`hex("bfcad4"))]), + selector(".chart .area-path", [SVG.fill(chartColor)]), + ]); +}; + +[@react.component] +let make = + ( + ~data, + ~minX=?, + ~maxX=?, + ~height=200, + ~color=`hex("111"), + ~onHover: float => unit, + ) => { +
+ Shape.XYShape.toJs} + /> +
; +}; \ No newline at end of file diff --git a/src/components/charts/ChartSimple.re b/src/components/charts/ChartSimple.re new file mode 100644 index 00000000..37f8697c --- /dev/null +++ b/src/components/charts/ChartSimple.re @@ -0,0 +1,24 @@ +module Styles = { + open Css; + let graph = chartColor => + style([ + selector(".axis", [fontSize(`px(9))]), + selector(".domain", [display(`none)]), + selector(".tick line", [display(`none)]), + selector(".tick text", [color(`hex("bfcad4"))]), + selector(".chart .area-path", [SVG.fill(chartColor)]), + ]); +}; + +[@react.component] +let make = (~minX=None, ~maxX=None, ~height=50, ~color=`hex("7e9db7")) => +
+ +
; \ No newline at end of file diff --git a/src/components/charts/ChartWithNumber.re b/src/components/charts/ChartWithNumber.re new file mode 100644 index 00000000..b8ac5bfb --- /dev/null +++ b/src/components/charts/ChartWithNumber.re @@ -0,0 +1,23 @@ +[@react.component] +let make = (~data, ~color=?) => { + let (x, setX) = React.useState(() => 0.); + let chart = + React.useMemo1( + () => setX(_ => r)} />, + [|data|], + ); +
+ chart +
{x |> E.Float.toString |> ReasonReact.string}
+
+ {Shape.Continuous.findY(x, data) + |> E.Float.toString + |> ReasonReact.string} +
+
+ {Shape.Continuous.findY(x, Shape.XYShape.integral(data)) + |> E.Float.toString + |> ReasonReact.string} +
+
; +}; \ No newline at end of file diff --git a/src/components/charts/cdfChartReact.js b/src/components/charts/cdfChartReact.js new file mode 100644 index 00000000..f72e5db7 --- /dev/null +++ b/src/components/charts/cdfChartReact.js @@ -0,0 +1,66 @@ +import React, { useEffect } from 'react'; +import { useSize } from 'react-use'; + +import chart from './cdfChartd3'; + +/** + * @param min + * @param max + * @returns {number} + */ +function getRandomInt(min, max) { + min = Math.ceil(min); + max = Math.floor(max); + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +/** + * Example input: + * { + * xs: [50,100,300,400,500,600], + * ys: [0.1, 0.4, 0.6, 0.7,0.8, 0.9]} + * } + */ +function CdfChart(props) { + const id = "chart-" + getRandomInt(0, 100000); + const [sized, { width }] = useSize(() => { + return React.createElement("div", { + key: "resizable-div", + }); + }, { + width: props.width, + }); + + useEffect(() => { + chart() + .svgWidth(width) + .svgHeight(props.height) + .maxX(props.maxX) + .minX(props.minX) + .onHover(props.onHover) + .marginBottom(props.marginBottom || 15) + .marginLeft(5) + .marginRight(5) + .marginTop(5) + .showDistributionLines(props.showDistributionLines) + .verticalLine(props.verticalLine) + .showVerticalLine(props.showVerticalLine) + .container("#" + id) + .data({ primary: props.primaryDistribution }).render(); + }); + + const style = !!props.width ? { width: props.width + "px" } : {}; + const key = id; + + return React.createElement("div", { + style: { + paddingLeft: "10px", + paddingRight: "10px", + }, + }, [ + sized, + React.createElement("div", { id, style, key }), + ]); +} + +export default CdfChart; diff --git a/src/components/charts/cdfChartd3.js b/src/components/charts/cdfChartd3.js new file mode 100644 index 00000000..a57b8cb1 --- /dev/null +++ b/src/components/charts/cdfChartd3.js @@ -0,0 +1,302 @@ +import * as d3 from 'd3'; + +function chart() { + // Id for event handlings. + var attrs = { + id: 'ID' + Math.floor(Math.random() * 1000000), + svgWidth: 400, + svgHeight: 400, + + marginTop: 5, + marginBottom: 5, + marginRight: 5, + marginLeft: 5, + + container: 'body', + minX: false, + maxX: false, + scale: 'linear', + showDistributionLines: true, + areaColors: ['#E1E5EC', '#E1E5EC'], + logBase: 10, + verticalLine: 110, + showVerticalLine: true, + data: null, + onHover: (e) => {}, + }; + + var main = function main() { + // Drawing containers. + var container = d3.select(attrs.container); + + if (container.node() === null) { + return; + } + + var containerRect = container.node().getBoundingClientRect(); + if (containerRect.width > 0) { + attrs.svgWidth = containerRect.width; + } + + // Calculated properties. + // id for event handlings. + var calc = {}; + calc.id = 'ID' + Math.floor(Math.random() * 1000000); + calc.chartLeftMargin = attrs.marginLeft; + calc.chartTopMargin = attrs.marginTop; + calc.chartWidth = attrs.svgWidth - attrs.marginRight - attrs.marginLeft; + calc.chartHeight = attrs.svgHeight - attrs.marginBottom - attrs.marginTop; + + var areaColor = d3.scaleOrdinal().range(attrs.areaColors); + + var dataPoints = [getDatapoints('primary')]; + + // Scales. + var xScale; + + var xMin = d3.min(attrs.data.primary.xs); + var xMax = d3.max(attrs.data.primary.xs); + + if (attrs.scale === 'linear') { + xScale = d3.scaleLinear() + .domain([ + attrs.minX || xMin, + attrs.maxX || xMax + ]) + .range([0, calc.chartWidth]); + } else { + xScale = d3.scaleLog() + .base(attrs.logBase) + .domain([ + attrs.minX, + attrs.maxX, + ]) + .range([0, calc.chartWidth]); + } + + var yMin = d3.min(attrs.data.primary.ys); + var yMax = d3.max(attrs.data.primary.ys); + + var yScale = d3.scaleLinear() + .domain([ + yMin, + yMax, + ]) + .range([calc.chartHeight, 0]); + + // Axis generator. + var xAxis = d3.axisBottom(xScale) + .ticks(3) + .tickFormat(d => { + if (Math.abs(d) < 1) { + return d3.format(".2")(d); + } else if (xMin > 1000 && xMax < 3000) { + // Condition which identifies years; 2019, 2020, 2021. + return d3.format(".0")(d); + } else { + var prefix = d3.formatPrefix(".0", d); + var output = prefix(d); + return output.replace("G", "B"); + } + }); + + // Line generator. + var line = d3.line() + .x(function (d, i) { + return xScale(d.x); + }) + .y(function (d, i) { + return yScale(d.y); + }); + + var area = d3.area() + .x(function (d, i) { + return xScale(d.x); + }) + .y1(function (d, i) { + return yScale(d.y); + }) + .y0(calc.chartHeight); + + // Add svg. + var svg = container + .patternify({ tag: 'svg', selector: 'svg-chart-container' }) + .attr('width', "100%") + .attr('height', attrs.svgHeight) + .attr('pointer-events', 'none'); + + // Add container g element. + var chart = svg + .patternify({ tag: 'g', selector: 'chart' }) + .attr( + 'transform', + 'translate(' + calc.chartLeftMargin + ',' + calc.chartTopMargin + ')', + ); + + // Add axis. + chart.patternify({ tag: 'g', selector: 'axis' }) + .attr('transform', 'translate(' + 0 + ',' + calc.chartHeight + ')') + .call(xAxis); + + // Draw area. + chart + .patternify({ + tag: 'path', + selector: 'area-path', + data: dataPoints + }) + .attr('d', area) + .attr('fill', (d, i) => areaColor(i)) + .attr('opacity', (d, i) => i === 0 ? 0.7 : 1); + + // Draw line. + if (attrs.showDistributionLines) { + chart + .patternify({ + tag: 'path', + selector: 'line-path', + data: dataPoints + }) + .attr('d', line) + .attr('id', (d, i) => 'line-' + (i + 1)) + .attr('opacity', (d, i) => { + return i === 0 ? 0.7 : 1 + }) + .attr('fill', 'none'); + } + + if (attrs.showVerticalLine) { + chart.patternify({ tag: 'line', selector: 'v-line' }) + .attr('x1', xScale(attrs.verticalLine)) + .attr('x2', xScale(attrs.verticalLine)) + .attr('y1', 0) + .attr('y2', calc.chartHeight) + .attr('stroke-width', 1.5) + .attr('stroke-dasharray', '6 6') + .attr('stroke', 'steelblue'); + } + + var hoverLine = chart.patternify({ tag: 'line', selector: 'hover-line' }) + .attr('x1', 0) + .attr('x2', 0) + .attr('y1', 0) + .attr('y2', calc.chartHeight) + .attr('opacity', 0) + .attr('stroke-width', 1.5) + .attr('stroke-dasharray', '6 6') + .attr('stroke', '#22313F'); + + // Add drawing rectangle. + chart.patternify({ tag: 'rect', selector: 'mouse-rect' }) + .attr('width', calc.chartWidth) + .attr('height', calc.chartHeight) + .attr('fill', 'transparent') + .attr('pointer-events', 'all') + .on('mouseover', mouseover) + .on('mousemove', mouseover) + .on('mouseout', mouseout); + + function mouseover() { + var mouse = d3.mouse(this); + + hoverLine.attr('opacity', 1) + .attr('x1', mouse[0]) + .attr('x2', mouse[0]); + + var range = [ + xScale(dataPoints[dataPoints.length - 1][0].x), + xScale( + dataPoints + [dataPoints.length - 1] + [dataPoints[dataPoints.length - 1].length - 1].x, + ), + ]; + + var xValue = xScale.invert(mouse[0]).toFixed(2); + + if (mouse[0] > range[0] && mouse[0] < range[1]) { + attrs.onHover(xValue); + } else { + attrs.onHover(0.0); + } + } + + function mouseout() { + hoverLine.attr('opacity', 0) + } + + /** + * @param key + * @returns {[]} + */ + function getDatapoints(key) { + var dt = []; + var data = attrs.data[key]; + var len = data.xs.length; + + for (let i = 0; i < len; i++) { + dt.push({ + x: data.xs[i], + y: data.ys[i] + }) + } + + return dt; + } + }; + + d3.selection.prototype.patternify = function patternify(params) { + var container = this; + var selector = params.selector; + var elementTag = params.tag; + var data = params.data || [selector]; + + // Pattern in action. + var selection = container.selectAll('.' + selector).data(data, (d, i) => { + if (typeof d === 'object') { + if (d.id) { + return d.id; + } + } + return i; + }); + + selection.exit().remove(); + selection = selection.enter().append(elementTag).merge(selection); + selection.attr('class', selector); + return selection; + }; + + // @todo: Do not do like that. + // Dynamic keys functions. + // Attach variables to main function. + Object.keys(attrs).forEach((key) => { + main[key] = function (_) { + if (!arguments.length) { + return attrs[key]; + } + attrs[key] = _; + return main; + }; + }); + + //Set attrs as property. + main.attrs = attrs; + + //Exposed update functions. + main.data = function data(value) { + if (!arguments.length) return attrs.data; + attrs.data = value; + return main; + }; + + // Run visual. + main.render = function render() { + main(); + return main; + }; + + return main; +} + +export default chart; diff --git a/src/core/MixedCdf.re b/src/core/MixedCdf.re index 8ffb7b31..2006df48 100644 --- a/src/core/MixedCdf.re +++ b/src/core/MixedCdf.re @@ -8,8 +8,7 @@ type yPdfPoint = { let getY = (t: t, x: float): yPdfPoint => { continuous: Shape.Continuous.findY(x, t.continuous), discrete: Shape.Discrete.findY(x, t.discrete), -} /* }*/; +} /* discrete: Shape.Discrete.findY(x, t.discrete)*/; // let getIntegralY = (t: t, x: float): float => { -// continuous: Shape.Continuous.findY(x, t.continuous), -// discrete: Shape.Discrete.findY(x, t.discrete), \ No newline at end of file +// continuous: Shape.Continuous.findY(x, t.continuous), \ No newline at end of file diff --git a/src/core/Shape.re b/src/core/Shape.re index 507e05a7..7d0ebe06 100644 --- a/src/core/Shape.re +++ b/src/core/Shape.re @@ -3,7 +3,7 @@ open DistributionTypes; let _lastElement = (a: array('a)) => switch (Belt.Array.size(a)) { | 0 => None - | n => Belt.Array.get(a, n) + | n => Belt.Array.get(a, n - 1) }; module XYShape = { @@ -28,7 +28,8 @@ module XYShape = { Belt.Array.zip(p.xs, p.ys) ->Belt.Array.reduce([||], (items, (x, y)) => switch (_lastElement(items)) { - | Some((_, yLast)) => [|(x, fn(y, yLast))|] + | Some((_, yLast)) => + Belt.Array.concat(items, [|(x, fn(y, yLast))|]) | None => [|(x, y)|] } ) diff --git a/src/utility/CdfLibrary.js b/src/utility/CdfLibrary.js index 528e2dda..ab9134de 100644 --- a/src/utility/CdfLibrary.js +++ b/src/utility/CdfLibrary.js @@ -1,5 +1,6 @@ const { Cdf, + Pdf, ContinuousDistribution, ContinuousDistributionCombination, scoringFunctions, diff --git a/src/utility/CdfLibrary.re b/src/utility/CdfLibrary.re index fdc08392..2354331c 100644 --- a/src/utility/CdfLibrary.re +++ b/src/utility/CdfLibrary.re @@ -38,7 +38,7 @@ module JS = { module Distribution = { let toPdf = dist => dist |> JS.doAsDist(JS.cdfToPdf); - let toCdf = dist => dist |> JS.doAsDist(JS.cdfToPdf); + let toCdf = dist => dist |> JS.doAsDist(JS.pdfToCdf); let findX = (y, dist) => dist |> JS.distToJs |> JS.findX(y); let findY = (x, dist) => dist |> JS.distToJs |> JS.findY(x); let integral = dist => dist |> JS.distToJs |> JS.integral; diff --git a/yarn.lock b/yarn.lock index fa7acb48..2e276981 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2967,6 +2967,43 @@ d3@5.9.2: d3-voronoi "1" d3-zoom "1" +d3@^5.15.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/d3/-/d3-5.15.0.tgz#ffd44958e6a3cb8a59a84429c45429b8bca5677a" + integrity sha512-C+E80SL2nLLtmykZ6klwYj5rPqB5nlfN5LdWEAVdWPppqTD8taoJi2PxLZjPeYT8FFRR2yucXq+kBlOnnvZeLg== + dependencies: + d3-array "1" + d3-axis "1" + d3-brush "1" + d3-chord "1" + d3-collection "1" + d3-color "1" + d3-contour "1" + d3-dispatch "1" + d3-drag "1" + d3-dsv "1" + d3-ease "1" + d3-fetch "1" + d3-force "1" + d3-format "1" + d3-geo "1" + d3-hierarchy "1" + d3-interpolate "1" + d3-path "1" + d3-polygon "1" + d3-quadtree "1" + d3-random "1" + d3-scale "2" + d3-scale-chromatic "1" + d3-selection "1" + d3-shape "1" + d3-time "1" + d3-time-format "2" + d3-timer "1" + d3-transition "1" + d3-voronoi "1" + d3-zoom "1" + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" From 9923021b4845c2b746423715c2e8bb262ffb9a35 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Mon, 17 Feb 2020 22:53:39 +0000 Subject: [PATCH 27/28] Attempt at simple graphs --- showcase/entries/Continuous.re | 53 +++++++++++--- showcase/index.html | 3 +- src/components/charts/ChartWithNumber.re | 23 ------- .../charts/GenericDistributionChart.re | 69 +++++++++++++++++++ src/components/charts/cdfChartd3.js | 2 +- 5 files changed, 116 insertions(+), 34 deletions(-) delete mode 100644 src/components/charts/ChartWithNumber.re create mode 100644 src/components/charts/GenericDistributionChart.re diff --git a/showcase/entries/Continuous.re b/showcase/entries/Continuous.re index 5475fd92..832d6789 100644 --- a/showcase/entries/Continuous.re +++ b/showcase/entries/Continuous.re @@ -1,19 +1,54 @@ open ForetoldComponents.Base; let data: DistributionTypes.xyShape = { - xs: [|0.2, 20., 80., 212., 330.|], - ys: [|0.0, 0.3, 0.5, 0.2, 0.1|], + xs: [|1., 10., 10., 200., 250., 292., 330.|], + ys: [|0.0, 0.0, 0.1, 0.3, 0.5, 0.2, 0.1|], }; -let alerts = () => +let mixedDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Unspecified, + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let timeDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=Complete, + ~unit=Time({zero: MomentRe.momentNow(), unit: `years}), + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let domainLimitedDist = + GenericDistribution.make( + ~generationSource=GuesstimatorString("mm(3, normal(5,1), [.5,.5])"), + ~probabilityType=Pdf, + ~domain=RightLimited({xPoint: 6.0, excludingProbabilityMass: 0.3}), + ~unit=Unspecified, + (), + ) + |> GenericDistribution.renderIfNeeded(~sampleCount=3000); + +let distributions = () =>
-
- Shape.XYShape.integral} - color={`hex("333")} - /> +

{"Basic Mixed Distribution" |> ReasonReact.string}

+ +
+
+

{"Time Distribution" |> ReasonReact.string}

+ +
+
+

{"Domain Limited Distribution" |> ReasonReact.string}

+
; -let entry = EntryTypes.(entry(~title="Pdf", ~render=alerts)); \ No newline at end of file +let entry = EntryTypes.(entry(~title="Pdf", ~render=distributions)); \ No newline at end of file diff --git a/showcase/index.html b/showcase/index.html index 7879deec..b459bc86 100644 --- a/showcase/index.html +++ b/showcase/index.html @@ -6,7 +6,8 @@ - + +