Removed the definitions tags in documentation

This commit is contained in:
Ozzie Gooen 2022-06-12 21:42:52 -07:00
parent bea4e13cd3
commit 5f26ac9532
2 changed files with 64 additions and 75 deletions

View File

@ -21,9 +21,7 @@ See a longer tutorial on creating distributions [here](/docs/Guides/Distribution
### normal ### normal
**Definitions** ```
```javascript
normal: (distribution|number, distribution|number) => distribution normal: (distribution|number, distribution|number) => distribution
normal: (dict<{p5: distribution|number, p95: distribution|number}>) => distribution normal: (dict<{p5: distribution|number, p95: distribution|number}>) => distribution
normal: (dict<{mean: distribution|number, stdev: distribution|number}>) => distribution normal: (dict<{mean: distribution|number, stdev: distribution|number}>) => distribution
@ -41,9 +39,7 @@ normal({ mean: uniform(5, 9), stdev: 3 })
### lognormal ### lognormal
**Definitions** ```
```javascript
lognormal: (distribution|number, distribution|number) => distribution lognormal: (distribution|number, distribution|number) => distribution
lognormal: (dict<{p5: distribution|number, p95: distribution|number}>) => distribution lognormal: (dict<{p5: distribution|number, p95: distribution|number}>) => distribution
lognormal: (dict<{mean: distribution|number, stdev: distribution|number}>) => distribution lognormal: (dict<{mean: distribution|number, stdev: distribution|number}>) => distribution
@ -59,9 +55,7 @@ lognormal({ mean: 5, stdev: 2 })
### uniform ### uniform
**Definitions** ```
```javascript
uniform: (distribution|number, distribution|number) => distribution uniform: (distribution|number, distribution|number) => distribution
``` ```
@ -73,9 +67,7 @@ uniform(10, 12)
### beta ### beta
**Definitions** ```
```javascript
beta: (distribution|number, distribution|number) => distribution beta: (distribution|number, distribution|number) => distribution
``` ```
@ -87,9 +79,7 @@ beta(20, 25)
### cauchy ### cauchy
**Definitions** ```
```javascript
cauchy: (distribution|number, distribution|number) => distribution cauchy: (distribution|number, distribution|number) => distribution
``` ```
@ -101,8 +91,6 @@ cauchy(5, 1)
### gamma ### gamma
**Definitions**
```javascript ```javascript
gamma: (distribution|number, distribution|number) => distribution gamma: (distribution|number, distribution|number) => distribution
``` ```
@ -115,9 +103,7 @@ gamma(5, 1)
### Logistic ### Logistic
**Definitions** ```
```javascript
logistic: (distribution|number, distribution|number) => distribution logistic: (distribution|number, distribution|number) => distribution
``` ```
@ -129,9 +115,7 @@ gamma(5, 1)
### exponential ### exponential
**Definitions** ```
```javascript
exponential: (distribution|number) => distribution exponential: (distribution|number) => distribution
``` ```
@ -143,9 +127,7 @@ exponential(2)
### bernoulli ### bernoulli
**Definitions** ```
```javascript
bernoulli: (distribution|number) => distribution bernoulli: (distribution|number) => distribution
``` ```
@ -157,8 +139,6 @@ bernoulli(0.5)
### triangular ### triangular
**Definitions**
```javascript ```javascript
triangular: (number, number, number) => distribution triangular: (number, number, number) => distribution
``` ```
@ -177,7 +157,7 @@ If both values are above zero, a `lognormal` distribution is used. If not, a `no
``To`` is an alias for ``credibleIntervalToDistribution``. However, because of its frequent use, it is recommended to use the shorter name. ``To`` is an alias for ``credibleIntervalToDistribution``. However, because of its frequent use, it is recommended to use the shorter name.
```javascript ```
to: (distribution|number, distribution|number) => distribution to: (distribution|number, distribution|number) => distribution
credibleIntervalToDistribution(distribution|number, distribution|number) => distribution credibleIntervalToDistribution(distribution|number, distribution|number) => distribution
``` ```
@ -193,7 +173,7 @@ to(5,10)
### mixture ### mixture
```javascript ```
mixture: (...distributionLike, weights?:list<float>) => distribution mixture: (...distributionLike, weights?:list<float>) => distribution
mixture: (list<distributionLike>, weights?:list<float>) => distribution mixture: (list<distributionLike>, weights?:list<float>) => distribution
``` ```
@ -212,8 +192,8 @@ mx([normal(5, 1), normal(10, 1)], [0.3, 0.7])
One random sample from the distribution One random sample from the distribution
```javascript ```
sample(distribution) => number sample: (distribution) => number
``` ```
**Examples** **Examples**
@ -226,7 +206,7 @@ sample(normal(5, 2))
N random samples from the distribution N random samples from the distribution
```javascript ```
sampleN: (distribution, number) => list<number> sampleN: (distribution, number) => list<number>
``` ```
@ -240,7 +220,7 @@ sampleN(normal(5, 2), 100)
The distribution mean The distribution mean
```javascript ```
mean: (distribution) => number mean: (distribution) => number
``` ```
@ -254,7 +234,7 @@ mean(normal(5, 2))
Standard deviation. Only works now on sample set distributions (so converts other distributions into sample set in order to calculate.) Standard deviation. Only works now on sample set distributions (so converts other distributions into sample set in order to calculate.)
```javascript ```
stdev: (distribution) => number stdev: (distribution) => number
``` ```
@ -262,19 +242,19 @@ stdev: (distribution) => number
Variance. Similar to stdev, only works now on sample set distributions. Variance. Similar to stdev, only works now on sample set distributions.
```javascript ```
variance: (distribution) => number variance: (distribution) => number
``` ```
### mode ### mode
```javascript ```
mode: (distribution) => number mode: (distribution) => number
``` ```
### cdf ### cdf
```javascript ```
cdf: (distribution, number) => number cdf: (distribution, number) => number
``` ```
@ -286,7 +266,7 @@ cdf(normal(5, 2), 3)
### pdf ### pdf
```javascript ```
pdf: (distribution, number) => number pdf: (distribution, number) => number
``` ```
@ -298,7 +278,7 @@ pdf(normal(5, 2), 3)
### quantile ### quantile
```javascript ```
quantile: (distribution, number) => number quantile: (distribution, number) => number
``` ```
@ -310,9 +290,11 @@ quantile(normal(5, 2), 0.5)
### toPointSet ### toPointSet
**TODO: Will soon be called "PointSet.make"**
Converts a distribution to the pointSet format Converts a distribution to the pointSet format
```javascript ```
toPointSet: (distribution) => pointSetDistribution toPointSet: (distribution) => pointSetDistribution
``` ```
@ -323,10 +305,11 @@ toPointSet(normal(5, 2))
``` ```
### toSampleSet ### toSampleSet
**TODO: Will soon be called "SampleSet.make"**
Converts a distribution to the sampleSet format, with n samples Converts a distribution to the sampleSet format, with n samples
```javascript ```
toSampleSet: (distribution, number) => sampleSetDistribution toSampleSet: (distribution, number) => sampleSetDistribution
``` ```
@ -340,7 +323,7 @@ toSampleSet(normal(5, 2), 1000)
Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the left side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```
truncateLeft: (distribution, l => number) => distribution truncateLeft: (distribution, l => number) => distribution
``` ```
@ -354,7 +337,7 @@ truncateLeft(normal(5, 2), 3)
Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution. Truncates the right side of a distribution. Returns either a pointSet distribution or a symbolic distribution.
```javascript ```
truncateRight: (distribution, r => number) => distribution truncateRight: (distribution, r => number) => distribution
``` ```
@ -368,7 +351,7 @@ truncateLeft(normal(5, 2), 6)
[KullbackLeibler divergence](https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence) between two distributions. [KullbackLeibler divergence](https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence) between two distributions.
```javascript ```
klDivergence: (distribution, distribution) => number klDivergence: (distribution, distribution) => number
``` ```
@ -382,7 +365,7 @@ klDivergence(normal(5, 2), normal(5, 4)) // returns 0.57
### toString ### toString
```javascript ```
toString: (distribution) => string toString: (distribution) => string
``` ```
@ -396,7 +379,7 @@ toString(normal(5, 2))
Produce a sparkline of length n Produce a sparkline of length n
```javascript ```
toSparkline: (distribution, n = 20) => string toSparkline: (distribution, n = 20) => string
``` ```
@ -410,7 +393,7 @@ toSparkline(normal(5, 2), 10)
Prints the value of the distribution to the Javascript console, then returns the distribution. Prints the value of the distribution to the Javascript console, then returns the distribution.
```javascript ```
inspect: (distribution) => distribution inspect: (distribution) => distribution
``` ```
@ -426,7 +409,7 @@ inspect(normal(5, 2))
Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1. Normalize a distribution. This means scaling it appropriately so that it's cumulative sum is equal to 1.
```javascript ```
normalize: (distribution) => distribution normalize: (distribution) => distribution
``` ```
@ -440,7 +423,7 @@ normalize(normal(5, 2))
Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions. Check of a distribution is normalized. Most distributions are typically normalized, but there are some commands that could produce non-normalized distributions.
```javascript ```
isNormalized: (distribution) => bool isNormalized: (distribution) => bool
``` ```
@ -454,7 +437,7 @@ isNormalized(normal(5, 2)) // returns true
Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1. Get the sum of the integral of a distribution. If the distribution is normalized, this will be 1.
```javascript ```
integralSum: (distribution) => number integralSum: (distribution) => number
``` ```
@ -476,10 +459,12 @@ pointMass(5 + 10) == pointMass(5) + pointMass(10)
### add ### add
```javascript ```
add: (distributionLike, distributionLike) => distribution add: (distributionLike, distributionLike) => distribution
``` ```
**Examples**
```javascript ```javascript
normal(0,1) + normal(1,3) // returns normal(1, 3.16...) normal(0,1) + normal(1,3) // returns normal(1, 3.16...)
add(normal(0,1), normal(1,3)) // returns normal(1, 3.16...) add(normal(0,1), normal(1,3)) // returns normal(1, 3.16...)
@ -488,68 +473,72 @@ add(normal(0,1), normal(1,3)) // returns normal(1, 3.16...)
### sum ### sum
**Todo: Not yet implemented for distributions** **Todo: Not yet implemented for distributions**
```javascript ```
sum: (list<distributionLike>) => distribution sum: (list<distributionLike>) => distribution
``` ```
**Examples**
```javascript ```javascript
sum([normal(0,1), normal(1,3), uniform(10,1)]) sum([normal(0,1), normal(1,3), uniform(10,1)])
``` ```
### multiply ### multiply
```javascript ```
multiply: (distributionLike, distributionLike) => distribution multiply: (distributionLike, distributionLike) => distribution
``` ```
### product ### product
```javascript ```
product: (list<distributionLike>) => distribution product: (list<distributionLike>) => distribution
``` ```
### subtract ### subtract
```javascript ```
subtract: (distributionLike, distributionLike) => distribution subtract: (distributionLike, distributionLike) => distribution
``` ```
### divide ### divide
```javascript ```
divide: (distributionLike, distributionLike) => distribution divide: (distributionLike, distributionLike) => distribution
``` ```
### pow ### pow
```javascript ```
pow: (distributionLike, distributionLike) => distribution pow: (distributionLike, distributionLike) => distribution
``` ```
### exp ### exp
```javascript ```
exp: (distributionLike, distributionLike) => distribution exp: (distributionLike, distributionLike) => distribution
``` ```
### log ### log
```javascript ```
log: (distributionLike, distributionLike) => distribution log: (distributionLike, distributionLike) => distribution
``` ```
### log10 ### log10
```javascript ```
log10: (distributionLike, distributionLike) => distribution log10: (distributionLike, distributionLike) => distribution
``` ```
### unaryMinus ### unaryMinus
```javascript ```
unaryMinus: (distribution) => distribution unaryMinus: (distribution) => distribution
``` ```
**Examples**
```javascript ```javascript
-(normal(5,2)) // same as normal(-5, 2) -(normal(5,2)) // same as normal(-5, 2)
unaryMinus(normal(5,2)) // same as normal(-5, 2) unaryMinus(normal(5,2)) // same as normal(-5, 2)
@ -559,37 +548,37 @@ unaryMinus(normal(5,2)) // same as normal(-5, 2)
### dotAdd ### dotAdd
```javascript ```
dotAdd: (distributionLike, distributionLike) => distribution dotAdd: (distributionLike, distributionLike) => distribution
``` ```
### dotMultiply ### dotMultiply
```javascript ```
dotMultiply: (distributionLike, distributionLike) => distribution dotMultiply: (distributionLike, distributionLike) => distribution
``` ```
### dotSubtract ### dotSubtract
```javascript ```
dotSubtract: (distributionLike, distributionLike) => distribution dotSubtract: (distributionLike, distributionLike) => distribution
``` ```
### dotDivide ### dotDivide
```javascript ```
dotDivide: (distributionLike, distributionLike) => distribution dotDivide: (distributionLike, distributionLike) => distribution
``` ```
### dotPow ### dotPow
```javascript ```
dotPow: (distributionLike, distributionLike) => distribution dotPow: (distributionLike, distributionLike) => distribution
``` ```
### dotExp ### dotExp
```javascript ```
dotExp: (distributionLike, distributionLike) => distribution dotExp: (distributionLike, distributionLike) => distribution
``` ```
@ -597,31 +586,31 @@ dotExp: (distributionLike, distributionLike) => distribution
### scaleMultiply ### scaleMultiply
```javascript ```
scaleMultiply: (distributionLike, number) => distribution scaleMultiply: (distributionLike, number) => distribution
``` ```
### scalePow ### scalePow
```javascript ```
scalePow: (distributionLike, number) => distribution scalePow: (distributionLike, number) => distribution
``` ```
### scaleExp ### scaleExp
```javascript ```
scaleExp: (distributionLike, number) => distribution scaleExp: (distributionLike, number) => distribution
``` ```
### scaleLog ### scaleLog
```javascript ```
scaleLog: (distributionLike, number) => distribution scaleLog: (distributionLike, number) => distribution
``` ```
### scaleLog10 ### scaleLog10
```javascript ```
scaleLog10: (distributionLike, number) => distribution scaleLog10: (distributionLike, number) => distribution
``` ```
@ -631,7 +620,7 @@ scaleLog10: (distributionLike, number) => distribution
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. 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.
```javascript ```
declareFn: (dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>) => declaration declareFn: (dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>) => declaration
``` ```

View File

@ -41,7 +41,7 @@ PointSet.makeDiscrete: (list<{x: number, y: number}>) => pointSetDist
``` ```
```javascript ```javascript
toDiscretePointSet([ PointSet.makeDiscrete([
{ x: 0, y: 0.1 }, { x: 0, y: 0.1 },
{ x: 1, y: 0.2 }, { x: 1, y: 0.2 },
{ x: 2, y: 0.15 }, { x: 2, y: 0.15 },