Attempting to make all api docs formatting mostly consistent

This commit is contained in:
Ozzie Gooen 2022-06-11 08:28:38 -07:00
parent 6dc8b711bb
commit 2d4d8a8f4d
5 changed files with 58 additions and 42 deletions

View File

@ -32,7 +32,7 @@ Dict.keys({foo: 3, bar: 20}) // ["foo", "bar"]
Dict.values: (dict<'a>) => list<'a>
```
```js
Dict.values({foo: 3, bar: 20}) // [3,20]
Dict.values({foo: 3, bar: 20}) // [3, 20]
```
### merge

View File

@ -222,7 +222,7 @@ toDiscretePointSet([
### mixture
```javascript
mixture: (...distributionLike, weights:list<float>):distribution
mixture: (...distributionLike, weights:list<float>) => distribution
```
**Examples**
@ -237,7 +237,7 @@ mx(normal(5, 1), normal(10, 1), [0.3, 0.7]);
Get one random sample from the distribution
```javascript
sample(distribution):number
sample(distribution) => number
```
**Examples**
@ -265,7 +265,7 @@ sample: (normal(5, 2), 100);
Get the distribution mean
```javascript
mean: (distribution):number
mean: (distribution) => number
```
**Examples**
@ -277,25 +277,25 @@ mean: (normal(5, 2));
### stdev
```javascript
stdev: (distribution):number
stdev: (distribution) => number
```
### variance
```javascript
variance: (distribution):number
variance: (distribution) => number
```
### mode
```javascript
mode: (distribution):number
mode: (distribution) => number
```
### cdf
```javascript
cdf: (distribution, number):number
cdf: (distribution, number) => number
```
**Examples**
@ -307,7 +307,7 @@ cdf: (normal(5, 2), 3);
### pdf
```javascript
pdf: (distribution, number):number
pdf: (distribution, number) => number
```
**Examples**
@ -319,7 +319,7 @@ pdf: (normal(5, 2), 3);
### inv
```javascript
inv: (distribution, number):number
inv: (distribution, number) => number
```
**Examples**
@ -361,7 +361,7 @@ toSampleSet(normal(5, 2), 1000);
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
```
**Examples**
@ -375,7 +375,7 @@ truncateLeft(normal(5, 2), 3);
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
```
**Examples**
@ -391,7 +391,7 @@ truncateLeft(normal(5, 2), 6);
KullbackLeibler divergence between two distributions
```javascript
klDivergence: (distribution, distribution):number
klDivergence: (distribution, distribution) => number
```
**Examples**
@ -405,7 +405,7 @@ klDivergence(normal(5, 2), normal(5, 4)); // returns 0.57
### toString
```javascript
: (distribution):string
: (distribution) => string
```
**Examples**
@ -419,7 +419,7 @@ toString(normal(5, 2));
Produce a sparkline of length n
```javascript
toSparkline: (distribution, n=20):string
toSparkline: (distribution, n=20) => string
```
**Examples**
@ -433,7 +433,7 @@ toSparkline(normal(5, 2), 10);
Prints the value of the distribution to the Javascript console, then returns the distribution.
```javascript
inspect: (distribution):distribution
inspect: (distribution) => distribution
```
**Examples**
@ -449,7 +449,7 @@ inspect(normal(5, 2));
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
```
**Examples**
@ -477,7 +477,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.
```javascript
integralSum: (distribution):number
integralSum: (distribution) => number
```
**Examples**
@ -491,67 +491,67 @@ integralSum(normal(5, 2));
### add
```javascript
add: (distributionLike, distributionLike): distribution
add: (distributionLike, distributionLike) => distribution
```
### sum
```javascript
sum: (list<distributionLike>): distribution
sum: (list<distributionLike>) => distribution
```
### multiply
```javascript
multiply: (distributionLike, distributionLike): distribution
multiply: (distributionLike, distributionLike) => distribution
```
### product
```javascript
product: (list<distributionLike>): distribution
product: (list<distributionLike>) => distribution
```
### subtract
```javascript
subtract: (distributionLike, distributionLike): distribution
subtract: (distributionLike, distributionLike) => distribution
```
### divide
```javascript
divide: (distributionLike, distributionLike): distribution
divide: (distributionLike, distributionLike) => distribution
```
### pow
```javascript
pow: (distributionLike, distributionLike): distribution
pow: (distributionLike, distributionLike) => distribution
```
### exp
```javascript
exp: (distributionLike, distributionLike): distribution
exp: (distributionLike, distributionLike) => distribution
```
### log
```javascript
log: (distributionLike, distributionLike): distribution
log: (distributionLike, distributionLike) => distribution
```
### log10
```javascript
log10: (distributionLike, distributionLike):distribution
log10: (distributionLike, distributionLike) => distribution
```
### unaryMinus
```javascript
unaryMinus: (distribution):distribution
unaryMinus: (distribution) => distribution
```
## Pointwise Operations
@ -559,37 +559,37 @@ unaryMinus: (distribution):distribution
### dotAdd
```javascript
dotAdd: (distributionLike, distributionLike): distribution
dotAdd: (distributionLike, distributionLike) => distribution
```
### dotMultiply
```javascript
dotMultiply: (distributionLike, distributionLike): distribution
dotMultiply: (distributionLike, distributionLike) => distribution
```
### dotSubtract
```javascript
dotSubtract: (distributionLike, distributionLike): distribution
dotSubtract: (distributionLike, distributionLike) => distribution
```
### dotDivide
```javascript
dotDivide: (distributionLike, distributionLike): distribution
dotDivide: (distributionLike, distributionLike) => distribution
```
### dotPow
```javascript
dotPow: (distributionLike, distributionLike): distribution
dotPow: (distributionLike, distributionLike) => distribution
```
### dotExp
```javascript
dotExp: (distributionLike, distributionLike): distribution
dotExp: (distributionLike, distributionLike) => distribution
```
## Scale Operations
@ -597,31 +597,31 @@ dotExp: (distributionLike, distributionLike): distribution
### scaleMultiply
```javascript
scaleMultiply: (distributionLike, number): distribution
scaleMultiply: (distributionLike, number) => distribution
```
### scalePow
```javascript
scalePow: (distributionLike, number): distribution
scalePow: (distributionLike, number) => distribution
```
### scaleExp
```javascript
scaleExp: (distributionLike, number): distribution
scaleExp: (distributionLike, number) => distribution
```
### scaleLog
```javascript
scaleLog: (distributionLike, number): distribution
scaleLog: (distributionLike, number) => distribution
```
### scaleLog10
```javascript
scaleLog10: (distributionLike, number): distribution
scaleLog10: (distributionLike, number) => distribution
```
## Special

View File

@ -3,11 +3,17 @@ sidebar_position: 6
title: Duration
---
import TOCInline from "@theme/TOCInline";
<TOCInline toc={toc} />
### toString
```
toString: (duration) => string
```
## Units
### minutes
```
minutes: (number) => duration
@ -48,6 +54,8 @@ toDays: (duration) => number
toYears: (duration) => number
```
## Algebra
### add
```
add: (duration, duration) => duration

View File

@ -10,7 +10,7 @@ List.make: (number, 'a) => list<'a>
Returns an array of size ``n`` filled with value ``e``.
```js
List.make(4, 1) // creates the list [1,1,1,1]
List.make(4, 1) // creates the list [1, 1, 1, 1]
```
See [Rescript implementation](https://rescript-lang.org/docs/manual/latest/api/belt/array#make)
@ -30,7 +30,7 @@ length: (list<'a>) => number
List.upTo: (low:number, high:number) => list<number>
```
```js
List.upTo(0, 5) // creates the list [0,1,2,3,4,5]
List.upTo(0, 5) // creates the list [0, 1, 2, 3, 4, 5]
```
Syntax taken from [Ruby](https://apidock.com/ruby/v2_5_5/Integer/upto).

View File

@ -3,6 +3,10 @@ sidebar_position: 9
title: Number
---
import TOCInline from "@theme/TOCInline";
<TOCInline toc={toc} />
### ceil
```javascript
@ -27,6 +31,8 @@ abs: (number) => number
round: (number) => number
```
## Statistics
### max
```javascript
@ -57,6 +63,8 @@ stdev: (list<number>) => number
variance: (list<number>) => number
```
## Algebra
### unaryMinus
```javascript