diff --git a/packages/website/docs/Api/Dict.md b/packages/website/docs/Api/Dict.md index 758047b6..c2716fa5 100644 --- a/packages/website/docs/Api/Dict.md +++ b/packages/website/docs/Api/Dict.md @@ -9,49 +9,42 @@ title: Dict (dict):string ``` - ### get ```javascript (dict, string):a ``` - ### set ```javascript (dict, string, a):a ``` - ### toPairs ```javascript (dict):list> ``` - ### keys ```javascript (dict):list ``` - ### values ```javascript (dict):list ``` - ### merge ```javascript (dict, dict):dict ``` - ### mergeMany ```javascript diff --git a/packages/website/docs/Api/Distribution.md b/packages/website/docs/Api/Distribution.md index 92da030b..e3184305 100644 --- a/packages/website/docs/Api/Distribution.md +++ b/packages/website/docs/Api/Distribution.md @@ -2,6 +2,7 @@ sidebar_position: 2 title: Distribution --- + ## Main ### mixture @@ -11,11 +12,13 @@ title: Distribution ``` **Examples** + ```javascript -mixture(normal(5,1), normal(10,1)) +mixture(normal(5, 1), normal(10, 1)); ``` ### sample + Get one random sample from the distribution ```javascript @@ -23,11 +26,13 @@ Get one random sample from the distribution ``` **Examples** + ```javascript -sample(normal(5,2)) +sample(normal(5, 2)); ``` ### sampleN + Get n random samples from the distribution ```javascript @@ -35,11 +40,13 @@ Get n random samples from the distribution ``` **Examples** + ```javascript -sample(normal(5,2), 100) +sample(normal(5, 2), 100); ``` ### mean + Get the distribution mean ```javascript @@ -47,8 +54,9 @@ Get the distribution mean ``` **Examples** + ```javascript -mean(normal(5,2)) +mean(normal(5, 2)); ``` ### stdev @@ -57,21 +65,18 @@ mean(normal(5,2)) (distribution):number ``` - ### variance ```javascript (distribution):number ``` - ### mode ```javascript (distribution):number ``` - ### cdf ```javascript @@ -79,8 +84,9 @@ mean(normal(5,2)) ``` **Examples** + ```javascript -cdf(normal(5,2), 3) +cdf(normal(5, 2), 3); ``` ### pdf @@ -90,8 +96,9 @@ cdf(normal(5,2), 3) ``` **Examples** + ```javascript -pdf(normal(5,2), 3) +pdf(normal(5, 2), 3); ``` ### pmf @@ -101,8 +108,9 @@ pdf(normal(5,2), 3) ``` **Examples** + ```javascript -pmf(bernoulli(0.3), 0) // 0.7 +pmf(bernoulli(0.3), 0); // 0.7 ``` ### inv @@ -112,11 +120,13 @@ pmf(bernoulli(0.3), 0) // 0.7 ``` **Examples** + ```javascript -inv(normal(5,2), 0.5) +inv(normal(5, 2), 0.5); ``` ### toPointSet + Converts a distribution to the pointSet format ```javascript @@ -124,11 +134,13 @@ Converts a distribution to the pointSet format ``` **Examples** + ```javascript -toPointSet(normal(5,2)) +toPointSet(normal(5, 2)); ``` ### toSampleSet + Converts a distribution to the sampleSet format, with n samples ```javascript @@ -136,11 +148,13 @@ Converts a distribution to the sampleSet format, with n samples ``` **Examples** + ```javascript -toSampleSet(normal(5,2)) +toSampleSet(normal(5, 2)); ``` ### truncateLeft + Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution. ```javascript @@ -148,11 +162,13 @@ Truncates the left side of a distribution. Returns either a pointSet distributio ``` **Examples** + ```javascript -truncateLeft(normal(5,2), 3) +truncateLeft(normal(5, 2), 3); ``` ### truncateRight + Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution. ```javascript @@ -160,11 +176,13 @@ Truncates the right side of a distribution. Returns either a pointSet distributi ``` **Examples** + ```javascript -truncateLeft(normal(5,2), 6) +truncateLeft(normal(5, 2), 6); ``` ### klDivergence + Kullback–Leibler divergence between two distributions ```javascript @@ -172,8 +190,9 @@ Kullback–Leibler divergence between two distributions ``` **Examples** + ```javascript -klDivergence(normal(5,2), normal(5,4)) // returns 0.57 +klDivergence(normal(5, 2), normal(5, 4)); // returns 0.57 ``` ### logScore @@ -183,8 +202,9 @@ klDivergence(normal(5,2), normal(5,4)) // returns 0.57 ``` **Examples** + ```javascript -logScore({estimate: normal(5,2), prior: normal(5.5,4), answer: 2.3}) +logScore({ estimate: normal(5, 2), prior: normal(5.5, 4), answer: 2.3 }); ``` ### toString @@ -194,11 +214,13 @@ logScore({estimate: normal(5,2), prior: normal(5.5,4), answer: 2.3}) ``` **Examples** + ```javascript -toString(normal(5,2)) +toString(normal(5, 2)); ``` ### toSparkline + Produce a sparkline of length n ```javascript @@ -206,11 +228,13 @@ Produce a sparkline of length n ``` **Examples** + ```javascript -toSparkline(normal(5,2), 10) +toSparkline(normal(5, 2), 10); ``` ### inspect + Prints the value of the distribution to the Javascript console, then returns the distribution. ```javascript @@ -218,11 +242,13 @@ Prints the value of the distribution to the Javascript console, then returns the ``` **Examples** + ```javascript -inspect(normal(5,2)) +inspect(normal(5, 2)); ``` ### normalize + Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1. ```javascript @@ -230,11 +256,13 @@ Normalize a distribution. This means scaling it appropriately so that it's cumul ``` **Examples** + ```javascript -normalize(normal(5,2)) +normalize(normal(5, 2)); ``` ### isNormalized + Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions. ```javascript @@ -242,11 +270,13 @@ Check of a distribution is normalized. Most distributions are typically normaliz ``` **Examples** + ```javascript -isNormalized(normal(5,2)) // returns true +isNormalized(normal(5, 2)); // returns true ``` ### integralSum + Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1. ```javascript @@ -254,8 +284,9 @@ Get the sum of the integral of a distribution. If the distribution is normalized ``` **Examples** + ```javascript -integralSum(normal(5,2)) +integralSum(normal(5, 2)); ``` ### add @@ -264,171 +295,146 @@ integralSum(normal(5,2)) (distributionLike, distributionLike): distribution ``` - ### sum ```javascript (list): distribution ``` - ### multiply ```javascript (distributionLike, distributionLike): distribution ``` - ### product ```javascript (list): distribution ``` - ### subtract ```javascript (distributionLike, distributionLike): distribution ``` - ### divide ```javascript (distributionLike, distributionLike): distribution ``` - ### pow ```javascript (distributionLike, distributionLike): distribution ``` - ### exp ```javascript (distributionLike, distributionLike): distribution ``` - ### log ```javascript (distributionLike, distributionLike): distribution ``` - ### log10 ```javascript (distributionLike, distributionLike):distribution ``` - ### unaryMinus ```javascript (distribution):distribution ``` - ### dotAdd ```javascript (distributionLike, distributionLike): distribution ``` - ### dotSum ```javascript (list): distribution ``` - ### dotMultiply ```javascript (distributionLike, distributionLike): distribution ``` - ### dotProduct ```javascript (list): distribution ``` - ### dotSubtract ```javascript (distributionLike, distributionLike): distribution ``` - ### dotDivide ```javascript (distributionLike, distributionLike): distribution ``` - ### dotPow ```javascript (distributionLike, distributionLike): distribution ``` - ### dotExp ```javascript (distributionLike, distributionLike): distribution ``` - ### scaleMultiply ```javascript (distributionLike, distributionLike): distribution ``` - ### scalePow ```javascript (distributionLike, distributionLike): distribution ``` - ### scaleExp ```javascript (distributionLike, distributionLike): distribution ``` - ### scaleLog ```javascript (distributionLike, distributionLike): distribution ``` - ### scaleLog10 ```javascript (distributionLike, distributionLike): distribution ``` - ### scaleLogWithThreshold ```javascript (distributionLike, distributionLike, number): distribution ``` - diff --git a/packages/website/docs/Api/DistributionCreation.md b/packages/website/docs/Api/DistributionCreation.md index ce139608..6663d878 100644 --- a/packages/website/docs/Api/DistributionCreation.md +++ b/packages/website/docs/Api/DistributionCreation.md @@ -5,115 +5,136 @@ title: Distribution Creation ## Normal Distribution -**Definitions** +**Definitions** + ```javascript -normal(frValueDistOrNumber, frValueDistOrNumber) +normal(frValueDistOrNumber, frValueDistOrNumber); ``` + ```javascript normal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>) ``` + ```javascript normal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>) ``` **Examples** + ```javascript -normal(5,1) -normal({p5: 4, p95: 10}) -normal({mean: 5, stdev: 2}) +normal(5, 1); +normal({ p5: 4, p95: 10 }); +normal({ mean: 5, stdev: 2 }); ``` ## Lognormal Distribution -**Definitions** +**Definitions** + ```javascript -lognormal(frValueDistOrNumber, frValueDistOrNumber) +lognormal(frValueDistOrNumber, frValueDistOrNumber); ``` + ```javascript lognormal(dict<{p5: frValueDistOrNumber, p95: frValueDistOrNumber}>) ``` + ```javascript lognormal(dict<{mean: frValueDistOrNumber, stdev: frValueDistOrNumber}>) ``` **Examples** + ```javascript -lognormal(0.5, 0.8) -lognormal({p5: 4, p95: 10}) -lognormal({mean: 5, stdev: 2}) +lognormal(0.5, 0.8); +lognormal({ p5: 4, p95: 10 }); +lognormal({ mean: 5, stdev: 2 }); ``` ## Uniform Distribution -**Definitions** +**Definitions** + ```javascript -uniform(frValueDistOrNumber, frValueDistOrNumber) +uniform(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript -uniform(10, 12) +uniform(10, 12); ``` ## Beta Distribution -**Definitions** +**Definitions** + ```javascript -beta(frValueDistOrNumber, frValueDistOrNumber) +beta(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript -beta(20, 25) +beta(20, 25); ``` ## Cauchy Distribution -**Definitions** +**Definitions** + ```javascript -cauchy(frValueDistOrNumber, frValueDistOrNumber) +cauchy(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript -cauchy(5, 1) +cauchy(5, 1); ``` ## Gamma Distribution -**Definitions** +**Definitions** + ```javascript -gamma(frValueDistOrNumber, frValueDistOrNumber) +gamma(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript -gamma(5, 1) +gamma(5, 1); ``` ## Logistic Distribution -**Definitions** +**Definitions** + ```javascript -logistic(frValueDistOrNumber, frValueDistOrNumber) +logistic(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript -gamma(5, 1) +gamma(5, 1); ``` ## To (Distribution) -**Definitions** +**Definitions** + ```javascript -to(frValueDistOrNumber, frValueDistOrNumber) +to(frValueDistOrNumber, frValueDistOrNumber); ``` + ```javascript -credibleIntervalToDistribution(frValueDistOrNumber, frValueDistOrNumber) +credibleIntervalToDistribution(frValueDistOrNumber, frValueDistOrNumber); ``` **Examples** + ```javascript 5 to 10 to(5,10) @@ -122,73 +143,86 @@ to(5,10) ## Exponential -**Definitions** +**Definitions** + ```javascript -exponential(frValueDistOrNumber) +exponential(frValueDistOrNumber); ``` **Examples** + ```javascript -exponential(2) +exponential(2); ``` ## Bernoulli -**Definitions** +**Definitions** + ```javascript -bernoulli(frValueDistOrNumber) +bernoulli(frValueDistOrNumber); ``` **Examples** + ```javascript -bernoulli(0.5) +bernoulli(0.5); ``` ## toContinuousPointSet + Converts a set of points to a continuous distribution -**Definitions** +**Definitions** + ```javascript toContinuousPointSet(array>) ``` **Examples** + ```javascript toContinuousPointSet([ - {x: 0, y: 0.1}, - {x: 1, y: 0.2}, - {x: 2, y: 0.15}, - {x:3, y: 0.1} -]) + { x: 0, y: 0.1 }, + { x: 1, y: 0.2 }, + { x: 2, y: 0.15 }, + { x: 3, y: 0.1 }, +]); ``` ## toDiscretePointSet + Converts a set of points to a discrete distribution -**Definitions** +**Definitions** + ```javascript toDiscretePointSet(array>) ``` **Examples** + ```javascript toDiscretePointSet([ - {x: 0, y: 0.1}, - {x: 1, y: 0.2}, - {x: 2, y: 0.15}, - {x:3, y: 0.1} -]) + { x: 0, y: 0.1 }, + { x: 1, y: 0.2 }, + { x: 2, y: 0.15 }, + { x: 3, y: 0.1 }, +]); ``` ## Declaration (Continuous Function) + Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within. -**Definitions** +**Definitions** + ```javascript declareFn(dict<{fn: lambda, inputs: array>}>) ``` **Examples** + ```javascript declareFn({ fn: {|a,b| a }, @@ -197,4 +231,4 @@ declareFn({ {min: 30, max: 50} ] }) -``` \ No newline at end of file +``` diff --git a/packages/website/docs/Api/Duration.md b/packages/website/docs/Api/Duration.md index c4495dcb..767d9d40 100644 --- a/packages/website/docs/Api/Duration.md +++ b/packages/website/docs/Api/Duration.md @@ -9,86 +9,74 @@ title: Duration (duration):string ``` - ### minutes ```javascript (number):duration ``` - ### hours ```javascript (number):duration ``` - ### days ```javascript (number):duration ``` - ### years ```javascript (number):duration ``` - ### toHours ```javascript (duration):number ``` - ### toMinutes ```javascript (duration):number ``` - ### toDays ```javascript (duration):number ``` - ### toYears ```javascript (duration):number ``` - ### add ```javascript (duration, duration):duration ``` - ### subtract ```javascript (duration, duration):duration ``` - ### multiply ```javascript (duration, duration):duration ``` - ### divide ```javascript (duration, duration):duration -``` \ No newline at end of file +``` diff --git a/packages/website/docs/Api/List.md b/packages/website/docs/Api/List.md index c352f42d..46e1c3a6 100644 --- a/packages/website/docs/Api/List.md +++ b/packages/website/docs/Api/List.md @@ -9,177 +9,152 @@ title: List (list<'a>):string ``` - ### length ```javascript (list<'a>):number ``` - ### get ```javascript (list, number):a ``` - ### find ```javascript (list, e => bool):a ``` - ### filter ```javascript (list, e => bool):a ``` - ### set ```javascript (list, number, a):a ``` - ### shuffle ```javascript (list):list ``` - ### reverse ```javascript (list):list ``` - ### make ```javascript (number,a):list (number, (index:number => a)):list (pointSetDist):list ``` - ### range ```javascript (low:number, high:number) => list ``` - ### rangeBy ```javascript (low:number, high:number, increment: number) => list ``` - ### zip ```javascript (list, list):list> ``` - ### unzip ```javascript (list>):list, list> ``` - ### concat ```javascript (list, list): list ``` - ### concatMany ```javascript (list>):list ``` - ### slice ```javascript ``` - ### map ```javascript (list, (a -> b)): list ``` - ### reduce ```javascript ``` - ### reduceRight ```javascript ``` - ### includes ```javascript (list<'a>, 'a => bool):boolean ``` - ### every ```javascript (list<'a>, 'a => bool):boolean ``` - ### truncate ```javascript (list<'a>, number):list<'a> ``` - ### uniq ```javascript (list<'a>):list ``` - ### first ```javascript (list<'a>):'a ``` - ### last ```javascript (list<'a>):'a ``` - ### sort ```javascript (list<'a>):list -``` \ No newline at end of file +``` diff --git a/packages/website/docs/Api/Math.md b/packages/website/docs/Api/Math.md index 1a52077b..9791b3b7 100644 --- a/packages/website/docs/Api/Math.md +++ b/packages/website/docs/Api/Math.md @@ -4,87 +4,87 @@ title: Math --- ### E + Euler's number; ≈ 2.718281828459045 ```javascript -number +number; ``` - ### LN2 + Natural logarithm of 2; ≈ 0.6931471805599453 ```javascript -number +number; ``` - ### LN10 + Natural logarithm of 10; ≈ 2.302585092994046 ```javascript -number +number; ``` - ### LOG2E + Base 2 logarithm of E; ≈ 1.4426950408889634 ```javascript -number +number; ``` - ### LOG10E + Base 10 logarithm of E; ≈ 0.4342944819032518 ```javascript -number +number; ``` - ### PI + Pi - ratio of the circumference to the diameter of a circle; ≈ 3.141592653589793 ```javascript -number +number; ``` - ### SQRT1_2 + Square root of 1/2; ≈ 0.7071067811865476 ```javascript -number +number; ``` - ### SQRT2 + Square root of 2; ≈ 1.4142135623730951 ```javascript -number +number; ``` - ### PHI + Phi is the golden ratio. 1.618033988749895 ```javascript -number +number; ``` - ### TAU -Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi. 6.283185307179586 + +Tau is the ratio constant of a circle's circumference to radius, equal to 2 \* pi. 6.283185307179586 ```javascript -number +number; ``` - ### Infinity ```javascript -number -``` \ No newline at end of file +number; +``` diff --git a/packages/website/docs/Api/Number.md b/packages/website/docs/Api/Number.md index d8acfe52..66d9599b 100644 --- a/packages/website/docs/Api/Number.md +++ b/packages/website/docs/Api/Number.md @@ -3,191 +3,164 @@ sidebar_position: 6 title: Number --- - ### ceil ```javascript (number): number ``` - ### floor ```javascript (number): number ``` - ### abs ```javascript (number): number ``` - ### round ```javascript (number): number ``` - ### max ```javascript (list): number ``` - ### maxBy ```javascript (list, fn(element)):number ``` - ### min ```javascript (list): number ``` - ### minBy ```javascript (list, fn(element)):number ``` - ### random ```javascript -number +number; ``` - ### randomInt ```javascript -number +number; ``` - ### mean ```javascript (list): number ``` - ### median ```javascript (list): number ``` - ### mode ```javascript (list): number ``` - ### std ```javascript (list): number ``` - ### variance ```javascript (list): number ``` - ### unaryMinus ```javascript (number): number ``` - ### equal ```javascript (number, number): boolean ``` - ### add ```javascript (number, number): number ``` - ### sum ```javascript (number, number): number ``` - ### multiply ```javascript (number, number): number ``` - ### product ```javascript (number, number): number ``` - ### subtract ```javascript (number, number): number ``` - ### divide ```javascript (number, number): number ``` - ### pow ```javascript (number, number): number ``` - ### exp ```javascript (number): number ``` - ### log ```javascript (number, number=Math.e): number ``` - ### log10 ```javascript (number): number -``` \ No newline at end of file +``` diff --git a/packages/website/docs/Api/PointSetDist.md b/packages/website/docs/Api/PointSetDist.md index 9dfe976f..63add6a8 100644 --- a/packages/website/docs/Api/PointSetDist.md +++ b/packages/website/docs/Api/PointSetDist.md @@ -9,16 +9,14 @@ title: Point Set Distribution (list<{x: number, y: number}>): pointSetDist ``` - ### makeDiscrete ```javascript (list<{x: number, y: number}>): pointSetDist ``` - ### map ```javascript (pointSetDist, ({x:number,y:number}=>{x:number,y:number})):pointSetDist -``` \ No newline at end of file +``` diff --git a/packages/website/docs/Api/SampleSetDist.md b/packages/website/docs/Api/SampleSetDist.md index b7553988..4115b26f 100644 --- a/packages/website/docs/Api/SampleSetDist.md +++ b/packages/website/docs/Api/SampleSetDist.md @@ -4,6 +4,7 @@ title: Sample Set Distribution --- ### toInternalSampleArray + Gets the internal samples of a sampleSet distribution. This is separate from the sampleN() function, which would shuffle the samples. toInternalSampleArray() maintains order and length. ```javascript @@ -11,8 +12,9 @@ Gets the internal samples of a sampleSet distribution. This is separate from the ``` **Examples** + ```javascript -toInternalSampleArray(toSampleSet(normal(5,2))) +toInternalSampleArray(toSampleSet(normal(5, 2))); ``` ### kde @@ -21,37 +23,32 @@ toInternalSampleArray(toSampleSet(normal(5,2))) (sampleSet):pointSetDist ``` - ### toEmpiricalPdf ```javascript (sampleSet):pointSetDist ``` - ### map ```javascript (sampleSet, (r => number)): sampleSet ``` - ### map2 ```javascript (sampleSet, sampleSet, ((d1, d2)=>number)): sampleSet ``` - ### map3 ```javascript (sampleSet, sampleSet, sampleSet, ((d1, d2, d3)=>number)): sampleSet ``` - ### make ```javascript (dist): sampleSet (()=>number): sampleSet (list): sampleSet -``` \ No newline at end of file +```