Adjusting documentation to reflect new functions
This commit is contained in:
parent
7316d27b54
commit
100ec2c1a8
|
@ -172,7 +172,7 @@ let library = [
|
|||
~nameSpace,
|
||||
~requiresNamespace,
|
||||
~examples=[
|
||||
`Sampleset.mapN([Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2))], {|x| max(x)`,
|
||||
`Sampleset.mapN([Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2)), Sampleset.maker(normal(5,2))], {|x| max(x)})`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~definitions=[
|
||||
|
|
|
@ -5,16 +5,14 @@ title: Date
|
|||
|
||||
Squiggle date types are a very simple implementation on [Javascript's Date type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). It's mainly here for early experimentation. There are more relevant functions for the [Duration](/docs/Api/Duration) type.
|
||||
|
||||
### makeFromYear
|
||||
|
||||
(Now `makeDateFromYear`)
|
||||
### fromYear
|
||||
|
||||
```
|
||||
Date.makeFromYear: (number) => date
|
||||
Date.fromYear: (number) => date
|
||||
```
|
||||
|
||||
```js
|
||||
makeFromYear(2022.32);
|
||||
Date.fromYear(2022.32);
|
||||
```
|
||||
|
||||
### toString
|
||||
|
@ -30,7 +28,7 @@ add: (date, duration) => date
|
|||
```
|
||||
|
||||
```js
|
||||
makeFromYear(2022.32) + years(5);
|
||||
Date.fromYear(2022.32) + years(5);
|
||||
```
|
||||
|
||||
### subtract
|
||||
|
@ -41,6 +39,6 @@ subtract: (date, duration) => date
|
|||
```
|
||||
|
||||
```js
|
||||
makeFromYear(2040) - makeFromYear(2020); // 20 years
|
||||
makeFromYear(2040) - years(20); // 2020
|
||||
Date.fromYear(2040) - Date.fromYear(2020); // 20 years
|
||||
Date.fromYear(2040) - years(20); // 2020
|
||||
```
|
||||
|
|
|
@ -653,28 +653,4 @@ scaleLog: (distributionLike, number) => distribution
|
|||
|
||||
```
|
||||
scaleLog10: (distributionLike, number) => distribution
|
||||
```
|
||||
|
||||
## Special
|
||||
|
||||
### Declaration (Continuous Functions)
|
||||
|
||||
Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making formal predictions. It allows you to limit the domain that your prediction will be used and scored within.
|
||||
|
||||
Declarations are currently experimental and will likely be removed or changed in the future.
|
||||
|
||||
```
|
||||
declareFn: (dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>) => declaration
|
||||
```
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
declareFn({
|
||||
fn: {|a,b| a },
|
||||
inputs: [
|
||||
{min: 0, max: 100},
|
||||
{min: 30, max: 50}
|
||||
]
|
||||
})
|
||||
```
|
||||
```
|
|
@ -3,10 +3,6 @@ sidebar_position: 4
|
|||
title: Point Set Distribution
|
||||
---
|
||||
|
||||
:::danger
|
||||
These functions aren't yet implemented with these specific names. This should be changed soon
|
||||
:::
|
||||
|
||||
Point set distributions are one of the three distribution formats. They are stored as a list of x-y coordinates representing both discrete and continuous distributions.
|
||||
|
||||
One complication is that it's possible to represent invalid probability distributions in the point set format. For example, you can represent shapes with negative values, or shapes that are not normalized.
|
||||
|
@ -21,8 +17,6 @@ PointSet.make: (distribution) => pointSetDist
|
|||
|
||||
### makeContinuous
|
||||
|
||||
**TODO: Now called "toContinuousPointSet"**
|
||||
|
||||
Converts a set of x-y coordinates directly into a continuous distribution.
|
||||
|
||||
```
|
||||
|
@ -40,8 +34,6 @@ PointSet.makeContinuous([
|
|||
|
||||
### makeDiscrete
|
||||
|
||||
**TODO: Now called "toDiscretePointSet"**
|
||||
|
||||
Converts a set of x-y coordinates directly into a discrete distribution.
|
||||
|
||||
```
|
||||
|
|
27
packages/website/docs/Api/Function.md
Normal file
27
packages/website/docs/Api/Function.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
sidebar_position: 6
|
||||
title: Function
|
||||
---
|
||||
|
||||
## declare (experimental)
|
||||
|
||||
Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making formal predictions. It allows you to limit the domain that your prediction will be used and scored within.
|
||||
|
||||
The one function that declarations currently have is that they impact plotting. If you ``declare`` a single-variable function within a specific range, this specific range will be plotted.
|
||||
|
||||
Declarations are currently experimental and will likely be removed or changed in the future.
|
||||
|
||||
```
|
||||
Function.declare: (dict<{fn: lambda, inputs: array<dict<{min: number, max: number}>>}>) => declaration
|
||||
```
|
||||
|
||||
**Examples**
|
||||
|
||||
```javascript
|
||||
Function.declare({
|
||||
fn: {|a| a+10 },
|
||||
inputs: [
|
||||
{min: 30, max: 100}
|
||||
]
|
||||
})
|
||||
```
|
|
@ -11,8 +11,6 @@ myList = [3, normal(5, 2), "random"];
|
|||
|
||||
### make
|
||||
|
||||
**Note: currently just called `makeList`, without the preix**
|
||||
|
||||
```
|
||||
List.make: (number, 'a) => list<'a>
|
||||
```
|
||||
|
@ -37,9 +35,7 @@ toString: (list<'a>) => string
|
|||
length: (list<'a>) => number
|
||||
```
|
||||
|
||||
### up to
|
||||
|
||||
**Note: currently just called `upTo`, without the preix**
|
||||
### upTo
|
||||
|
||||
```
|
||||
List.upTo: (low:number, high:number) => list<number>
|
||||
|
|
Loading…
Reference in New Issue
Block a user