Ran format

This commit is contained in:
Ozzie Gooen 2022-06-13 12:10:24 -07:00
parent 2dc71315ef
commit 6a4132c955
5 changed files with 22 additions and 18 deletions

View File

@ -273,7 +273,8 @@ let dispatchToGenericOutput = (
| ("cdf", [EvDistribution(dist), EvNumber(float)]) => Helpers.toFloatFn(#Cdf(float), dist, ~env)
| ("pdf", [EvDistribution(dist), EvNumber(float)]) => Helpers.toFloatFn(#Pdf(float), dist, ~env)
| ("inv", [EvDistribution(dist), EvNumber(float)]) => Helpers.toFloatFn(#Inv(float), dist, ~env)
| ("quantile", [EvDistribution(dist), EvNumber(float)]) => Helpers.toFloatFn(#Inv(float), dist, ~env)
| ("quantile", [EvDistribution(dist), EvNumber(float)]) =>
Helpers.toFloatFn(#Inv(float), dist, ~env)
| ("toSampleSet", [EvDistribution(dist), EvNumber(float)]) =>
Helpers.toDistFn(ToSampleSet(Belt.Int.fromFloat(float)), dist, ~env)
| ("toSampleSet", [EvDistribution(dist)]) =>

View File

@ -6,7 +6,8 @@ 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``)
(Now `makeDateFromYear`)
```
Date.makeFromYear: (number) => date

View File

@ -8,6 +8,7 @@ Squiggle dictionaries work similar to Python dictionaries. The syntax is similar
Dictionaries are unordered and duplicates are not allowed. They are meant to be immutable, like most types in Squiggle.
**Example**
```javascript
valueFromOfficeItems = {
keyboard: 1,

View File

@ -15,7 +15,7 @@ import TOCInline from "@theme/TOCInline"
## Distribution Creation
These are functions for creating primative distributions. Many of these could optionally take in distributions as inputs; in these cases, Monte Carlo Sampling will be used to generate the greater distribution. This can be used for simple hierarchical models.
These are functions for creating primative distributions. Many of these could optionally take in distributions as inputs. In these cases, Monte Carlo Sampling will be used to generate the greater distribution. This can be used for simple hierarchical models.
See a longer tutorial on creating distributions [here](/docs/Guides/DistributionCreation).
@ -155,7 +155,7 @@ The `to` function is an easy way to generate simple distributions using predicte
If both values are above zero, a `lognormal` distribution is used. If not, a `normal` distribution is used.
``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.
```
to: (distribution|number, distribution|number) => distribution
@ -170,7 +170,6 @@ to(5,10)
-5 to 5
```
### mixture
```
@ -239,8 +238,8 @@ stdev: (distribution) => number
```
### variance
Variance. Similar to stdev, only works now on sample set distributions.
Variance. Similar to stdev, only works now on sample set distributions.
```
variance: (distribution) => number
@ -305,6 +304,7 @@ toPointSet(normal(5, 2))
```
### toSampleSet
**TODO: Will soon be called "SampleSet.make"**
Converts a distribution to the sampleSet format, with n samples
@ -451,7 +451,7 @@ integralSum(normal(5, 2))
Regular arithmetic operations cover the basic mathematical operations on distributions. They work much like their equivalent operations on numbers.
The infixes ``+``,``-``, ``*``, ``/``, ``^``, ``-`` are supported for addition, subtraction, multiplication, division, power, and unaryMinus.
The infixes `+`,`-`, `*`, `/`, `^`, `-` are supported for addition, subtraction, multiplication, division, power, and unaryMinus.
```javascript
pointMass(5 + 10) == pointMass(5) + pointMass(10)
@ -471,6 +471,7 @@ add(normal(0,1), normal(1,3)) // returns normal(1, 3.16...)
```
### sum
**Todo: Not yet implemented for distributions**
```
@ -540,7 +541,7 @@ unaryMinus: (distribution) => distribution
**Examples**
```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)
```

View File

@ -7,7 +7,6 @@ title: Point Set Distribution
Converts the distribution in question into a point set distribution. If the distribution is symbolic, then it does this by taking the quantiles. If the distribution is a sample set, then it uses a version of kernel density estimation to approximate the point set format. One complication of this latter process is that if there is a high proportion of overlapping samples (samples that are exactly the same as each other), it will convert these samples into discrete point masses. Eventually we'd like to add further methods to help adjust this process.
```
PointSet.make: (distribution) => pointSetDist
```
@ -28,10 +27,11 @@ PointSet.makeContinuous([
{ x: 1, y: 0.2 },
{ x: 2, y: 0.15 },
{ x: 3, y: 0.1 },
])
]);
```
### makeDiscrete
**TODO: Now called "toDiscretePointSet"**
Converts a set of x-y coordinates directly into a discrete distribution.
@ -46,5 +46,5 @@ PointSet.makeDiscrete([
{ x: 1, y: 0.2 },
{ x: 2, y: 0.15 },
{ x: 3, y: 0.1 },
])
]);
```