Formatted
This commit is contained in:
parent
f7834b0f46
commit
b37e372815
|
@ -9,7 +9,7 @@ Much of the Squiggle math is imprecise. This can cause significant errors, so wa
|
||||||
|
|
||||||
Below are a few specific examples to watch for. We'll work on improving these over time and adding much better warnings and error management.
|
Below are a few specific examples to watch for. We'll work on improving these over time and adding much better warnings and error management.
|
||||||
|
|
||||||
## Operations on very small or large numbers, silently round to 0 and 1
|
## Operations on very small or large numbers, silently round to 0 and 1
|
||||||
|
|
||||||
Squiggle is poor at dealing with very small or large numbers, given fundamental limitations of floating point precision.
|
Squiggle is poor at dealing with very small or large numbers, given fundamental limitations of floating point precision.
|
||||||
See [this Github Issue](https://github.com/quantified-uncertainty/squiggle/issues/834).
|
See [this Github Issue](https://github.com/quantified-uncertainty/squiggle/issues/834).
|
||||||
|
|
|
@ -35,7 +35,9 @@ If both values are above zero, a `lognormal` distribution is used. If not, a `no
|
||||||
<SquiggleEditor defaultCode="-5 to -3" />
|
<SquiggleEditor defaultCode="-5 to -3" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="ex4" label="1 to 10000">
|
<TabItem value="ex4" label="1 to 10000">
|
||||||
It's very easy to generate distributions with very long tails. These can be impossible to see without changing view settings. (These settings are available in the Playground, but not this smaller editor component)
|
It's very easy to generate distributions with very long tails. These can be
|
||||||
|
impossible to see without changing view settings. (These settings are
|
||||||
|
available in the Playground, but not this smaller editor component)
|
||||||
<SquiggleEditor defaultCode="1 to 10000" />
|
<SquiggleEditor defaultCode="1 to 10000" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
@ -283,10 +285,7 @@ Creates a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) w
|
||||||
<TabItem value="ex5" label="beta(0.8, 0.8)">
|
<TabItem value="ex5" label="beta(0.8, 0.8)">
|
||||||
<SquiggleEditor defaultCode="beta(0.8, 0.8)" />
|
<SquiggleEditor defaultCode="beta(0.8, 0.8)" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem
|
<TabItem value="ex6" label="beta({mean: 0.39, stdev: 0.1})">
|
||||||
value="ex6"
|
|
||||||
label="beta({mean: 0.39, stdev: 0.1})"
|
|
||||||
>
|
|
||||||
<SquiggleEditor defaultCode="beta({mean: 0.39, stdev: 0.1})" />
|
<SquiggleEditor defaultCode="beta({mean: 0.39, stdev: 0.1})" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
@ -378,12 +377,14 @@ Creates a sample set distribution using an array of samples.
|
||||||
|
|
||||||
Creates a continuous point set distribution using a list of points.
|
Creates a continuous point set distribution using a list of points.
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`PointSet.makeContinuous([
|
<SquiggleEditor
|
||||||
|
defaultCode={`PointSet.makeContinuous([
|
||||||
{ 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 },
|
||||||
{ x: 3, y: 0.1 }
|
{ x: 3, y: 0.1 }
|
||||||
])`} />
|
])`}
|
||||||
|
/>
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
|
@ -395,12 +396,14 @@ Creates a continuous point set distribution using a list of points.
|
||||||
|
|
||||||
Creates a discrete point set distribution using a list of points.
|
Creates a discrete point set distribution using a list of points.
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`PointSet.makeDiscrete([
|
<SquiggleEditor
|
||||||
|
defaultCode={`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 },
|
||||||
{ x: 3, y: 0.1 }
|
{ x: 3, y: 0.1 }
|
||||||
])`} />
|
])`}
|
||||||
|
/>
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ Squiggle supports some simple types and language features.
|
||||||
<SquiggleEditor defaultCode="4.32" />
|
<SquiggleEditor defaultCode="4.32" />
|
||||||
|
|
||||||
## Distributions
|
## Distributions
|
||||||
|
|
||||||
There are several ways of easily entering distributions. See the [documentation](/docs/Api/Dist/) on distributions for a complete API.
|
There are several ways of easily entering distributions. See the [documentation](/docs/Api/Dist/) on distributions for a complete API.
|
||||||
|
|
||||||
<SquiggleEditor
|
<SquiggleEditor
|
||||||
|
@ -23,6 +24,7 @@ d`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
## Lists
|
## Lists
|
||||||
|
|
||||||
Squiggle lists can accept items of any type, similar to those in Python. [API](/docs/Api/List).
|
Squiggle lists can accept items of any type, similar to those in Python. [API](/docs/Api/List).
|
||||||
|
|
||||||
<SquiggleEditor
|
<SquiggleEditor
|
||||||
|
@ -30,6 +32,7 @@ Squiggle lists can accept items of any type, similar to those in Python. [API](/
|
||||||
/>
|
/>
|
||||||
|
|
||||||
## Dictionaries
|
## Dictionaries
|
||||||
|
|
||||||
Squiggle dictionaries work similarly to Python dictionaries. [API](/docs/Api/Dictionary).
|
Squiggle dictionaries work similarly to Python dictionaries. [API](/docs/Api/Dictionary).
|
||||||
|
|
||||||
<SquiggleEditor
|
<SquiggleEditor
|
||||||
|
@ -50,18 +53,23 @@ f`}
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`// This is a single-line comment\n
|
<SquiggleEditor
|
||||||
|
defaultCode={`// This is a single-line comment\n
|
||||||
/*
|
/*
|
||||||
This is a multiple
|
This is a multiple
|
||||||
-line comment.
|
-line comment.
|
||||||
*/
|
*/
|
||||||
""
|
""
|
||||||
`} />
|
`}
|
||||||
|
/>
|
||||||
|
|
||||||
## Pipes
|
## Pipes
|
||||||
|
|
||||||
Squiggle features [data-first](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/) pipes. Functions in the standard library are organized to make this convenient.
|
Squiggle features [data-first](https://www.javierchavarri.com/data-first-and-data-last-a-comparison/) pipes. Functions in the standard library are organized to make this convenient.
|
||||||
<SquiggleEditor defaultCode={`normal(5,2) |> truncateLeft(3) |> SampleSet.fromDist |> SampleSet.map({|r| r + 10})`} />
|
|
||||||
|
<SquiggleEditor
|
||||||
|
defaultCode={`normal(5,2) |> truncateLeft(3) |> SampleSet.fromDist |> SampleSet.map({|r| r + 10})`}
|
||||||
|
/>
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
|
|
||||||
|
@ -70,24 +78,30 @@ Squiggle features a simple [standard libary](/docs/Api/Dist).
|
||||||
Most functions are namespaced under their respective types to keep functionality distinct. Certain popular functions are usable without their namespaces.
|
Most functions are namespaced under their respective types to keep functionality distinct. Certain popular functions are usable without their namespaces.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
<SquiggleEditor defaultCode={`a = List.upTo(0, 5000) |> SampleSet.fromList // namespaces required
|
|
||||||
|
<SquiggleEditor
|
||||||
|
defaultCode={`a = List.upTo(0, 5000) |> SampleSet.fromList // namespaces required
|
||||||
b = normal(5,2) // namespace not required
|
b = normal(5,2) // namespace not required
|
||||||
c = 5 to 10 // namespace not required
|
c = 5 to 10 // namespace not required
|
||||||
""`} />
|
""`}
|
||||||
|
/>
|
||||||
|
|
||||||
## Number Prefixes
|
## Number Prefixes
|
||||||
|
|
||||||
Numbers support a few scientific notation prefixes.
|
Numbers support a few scientific notation prefixes.
|
||||||
|
|
||||||
| prefix | multiplier |
|
| prefix | multiplier |
|
||||||
|-----|-------|
|
| ------ | ---------- |
|
||||||
| n | 10^-9 |
|
| n | 10^-9 |
|
||||||
| m | 10^-3 |
|
| m | 10^-3 |
|
||||||
| k | 10^3 |
|
| k | 10^3 |
|
||||||
| M | 10^6 |
|
| M | 10^6 |
|
||||||
| B,G | 10^9 |
|
| B,G | 10^9 |
|
||||||
| T | 10^12 |
|
| T | 10^12 |
|
||||||
| P | 10^15 |
|
| P | 10^15 |
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`simpleNumber = 4.32k
|
<SquiggleEditor
|
||||||
|
defaultCode={`simpleNumber = 4.32k
|
||||||
distribution = 40M to 50M
|
distribution = 40M to 50M
|
||||||
distribution`} />
|
distribution`}
|
||||||
|
/>
|
||||||
|
|
|
@ -10,10 +10,12 @@ Squiggle is a minimalist programming language for probabilistic estimation. It's
|
||||||
The basics of Squiggle are fairly straightforward. This can be enough for many models. The more advanced functionality can take some time to learn.
|
The basics of Squiggle are fairly straightforward. This can be enough for many models. The more advanced functionality can take some time to learn.
|
||||||
|
|
||||||
## Simple example
|
## Simple example
|
||||||
|
|
||||||
Say you're trying to estimate the number of piano tuners in New York City. You can build a simple model of this, like so.
|
Say you're trying to estimate the number of piano tuners in New York City. You can build a simple model of this, like so.
|
||||||
(Tip: This is interactive! Feel free to modify the code directly.)
|
(Tip: This is interactive! Feel free to modify the code directly.)
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`
|
<SquiggleEditor
|
||||||
|
defaultCode={`
|
||||||
// Piano tuners in NYC over the next 5 years
|
// Piano tuners in NYC over the next 5 years
|
||||||
populationOfNewYork2022 = 8.1M to 8.4M // This means that you're 90% confident the value is between 8.1 and 8.4 Million.\n
|
populationOfNewYork2022 = 8.1M to 8.4M // This means that you're 90% confident the value is between 8.1 and 8.4 Million.\n
|
||||||
proportionOfPopulationWithPianos = {
|
proportionOfPopulationWithPianos = {
|
||||||
|
@ -26,13 +28,15 @@ pianoTunersPerPiano = {
|
||||||
} \n
|
} \n
|
||||||
totalTunersIn2022 = populationOfNewYork2022 * proportionOfPopulationWithPianos * pianoTunersPerPiano
|
totalTunersIn2022 = populationOfNewYork2022 * proportionOfPopulationWithPianos * pianoTunersPerPiano
|
||||||
totalTunersIn2022
|
totalTunersIn2022
|
||||||
`} />
|
`}
|
||||||
|
/>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Now let's take this a bit further. Let's imagine that you think that NYC will grow over time, and you'd like to estimate the number of piano tuners for every point in time for the next few years.
|
Now let's take this a bit further. Let's imagine that you think that NYC will grow over time, and you'd like to estimate the number of piano tuners for every point in time for the next few years.
|
||||||
|
|
||||||
<SquiggleEditor defaultCode={`// Piano tuners in NYC over the next 5 years
|
<SquiggleEditor
|
||||||
|
defaultCode={`// Piano tuners in NYC over the next 5 years
|
||||||
populationOfNewYork2022 = 8.1M to 8.4M\n
|
populationOfNewYork2022 = 8.1M to 8.4M\n
|
||||||
proportionOfPopulationWithPianos = {
|
proportionOfPopulationWithPianos = {
|
||||||
percentage = (.2 to 1)
|
percentage = (.2 to 1)
|
||||||
|
@ -52,13 +56,13 @@ totalTunersAtTime(t) = populationAtTime(t) * proportionOfPopulationWithPianos *
|
||||||
{
|
{
|
||||||
populationAtTime: populationAtTime,
|
populationAtTime: populationAtTime,
|
||||||
totalTunersAtTimeMedian: {|t| median(totalTunersAtTime(t))}
|
totalTunersAtTimeMedian: {|t| median(totalTunersAtTime(t))}
|
||||||
}`} />
|
}`}
|
||||||
|
/>
|
||||||
|
|
||||||
If you haven't noticed yet, you can hover over the `populationAtTime` graph to see the distribution of population at different points in time.
|
If you haven't noticed yet, you can hover over the `populationAtTime` graph to see the distribution of population at different points in time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Using Squiggle
|
## Using Squiggle
|
||||||
|
|
||||||
You can currently interact with Squiggle in a few ways:
|
You can currently interact with Squiggle in a few ways:
|
||||||
|
|
||||||
**[Playground](/playground)**
|
**[Playground](/playground)**
|
||||||
|
@ -93,6 +97,7 @@ You can use Squiggle Components in Observable notebooks. Sam Nolan put together
|
||||||
- A visually-driven tool. (See [Guesstimate](https://www.getguesstimate.com/) and [Causal](https://causal.app/))
|
- A visually-driven tool. (See [Guesstimate](https://www.getguesstimate.com/) and [Causal](https://causal.app/))
|
||||||
|
|
||||||
### Strengths
|
### Strengths
|
||||||
|
|
||||||
- Simple and readable syntax, especially for dealing with probabilistic math.
|
- Simple and readable syntax, especially for dealing with probabilistic math.
|
||||||
- Fast for relatively small models. Strong for rapid prototyping.
|
- Fast for relatively small models. Strong for rapid prototyping.
|
||||||
- Optimized for using some numeric and symbolic approaches, not just Monte Carlo.
|
- Optimized for using some numeric and symbolic approaches, not just Monte Carlo.
|
||||||
|
@ -100,6 +105,7 @@ You can use Squiggle Components in Observable notebooks. Sam Nolan put together
|
||||||
- Free and open-source.
|
- Free and open-source.
|
||||||
|
|
||||||
### Weaknesses
|
### Weaknesses
|
||||||
|
|
||||||
- Limited scientific capabilities.
|
- Limited scientific capabilities.
|
||||||
- Much slower than serious probabilistic programming languages on sizeable models.
|
- Much slower than serious probabilistic programming languages on sizeable models.
|
||||||
- Can't do Bayesian backwards inference.
|
- Can't do Bayesian backwards inference.
|
||||||
|
@ -109,4 +115,5 @@ You can use Squiggle Components in Observable notebooks. Sam Nolan put together
|
||||||
- Generally not as easy to use as Guesstimate or Causal, especially for non programmers.
|
- Generally not as easy to use as Guesstimate or Causal, especially for non programmers.
|
||||||
|
|
||||||
## Organization
|
## Organization
|
||||||
|
|
||||||
Squiggle is one of the main projects of [The Quantified Uncertainty Research Institute](https://quantifieduncertainty.org/). QURI is a nonprofit funded primarily by [Effective Altruist](https://www.effectivealtruism.org/) donors.
|
Squiggle is one of the main projects of [The Quantified Uncertainty Research Institute](https://quantifieduncertainty.org/). QURI is a nonprofit funded primarily by [Effective Altruist](https://www.effectivealtruism.org/) donors.
|
|
@ -10,12 +10,12 @@ function HomepageHeader() {
|
||||||
return (
|
return (
|
||||||
<header className={clsx("hero hero--primary", styles.heroBanner)}>
|
<header className={clsx("hero hero--primary", styles.heroBanner)}>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<img
|
<img
|
||||||
alt={'Docusaurus with Keytar'}
|
alt={"Docusaurus with Keytar"}
|
||||||
className={styles.heroLogo}
|
className={styles.heroLogo}
|
||||||
src={'/img/squiggle-logo.png'}
|
src={"/img/squiggle-logo.png"}
|
||||||
width="70"
|
width="70"
|
||||||
/>
|
/>
|
||||||
<h1 className="hero__title">{siteConfig.title}</h1>
|
<h1 className="hero__title">{siteConfig.title}</h1>
|
||||||
<p className="hero__subtitle">Early Access</p>
|
<p className="hero__subtitle">Early Access</p>
|
||||||
<p className="hero__subtitle2">{siteConfig.tagline}</p>
|
<p className="hero__subtitle2">{siteConfig.tagline}</p>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user