Lots of minor touch-ups

This commit is contained in:
Ozzie Gooen 2022-07-28 16:59:52 -07:00
parent 42528eb07e
commit f7834b0f46
6 changed files with 73 additions and 42 deletions

View File

@ -7,7 +7,12 @@ import { SquiggleEditor } from "../../src/components/SquiggleEditor";
Much of the Squiggle math is imprecise. This can cause significant errors, so watch out. Much of the Squiggle math is imprecise. This can cause significant errors, so watch out.
Below are some 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
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).
## Mixtures of distributions with very different means ## Mixtures of distributions with very different means

View File

@ -9,12 +9,15 @@ Squiggle is still very early. The main first goal is to become stable (to reach
- Tables / Matrices - Tables / Matrices
- A simple type system - A simple type system
- A simple time library & notation
- Optional and default paramaters for functions - Optional and default paramaters for functions
- A notation to limit the domain of functions. For example, maybe a function only applies for t=[2 to 20] - A notation to limit the domain of functions. For example, maybe a function only applies for t=[2 to 20]
- Some story for tests
- Much better code editor integration
## Distribution Features ## Distribution Features
There are many important distribution types that Squiggle doesn't yet support. Some key functions we'd like include:
[Metalog Distribution](https://en.wikipedia.org/wiki/Metalog_distribution) [Metalog Distribution](https://en.wikipedia.org/wiki/Metalog_distribution)
Add the Metalog distribution, and some convenient methods for generating these distributions. This might be a bit tricky because we might need or build a library to fit data. There's no Metalog javascript library yet, this would be pretty useful. There's already a Metalog library in Python, so that one could be used for inspiration. Add the Metalog distribution, and some convenient methods for generating these distributions. This might be a bit tricky because we might need or build a library to fit data. There's no Metalog javascript library yet, this would be pretty useful. There's already a Metalog library in Python, so that one could be used for inspiration.
@ -26,9 +29,6 @@ Takes a distribution and smoothens it. For example, [Elicit Forecast](https://fo
**Probabilities** **Probabilities**
Right now Squiggle mostly works with probability distributions only, but it should also work smoothly with probabilities. Right now Squiggle mostly works with probability distributions only, but it should also work smoothly with probabilities.
**Importance & quality scores**
Workflows/functionality to declare the importance and coveredness of each part of the paramater space. For example, some subsets of the paramater space of a function might be much more important to get right than others. Similarly, the analyst might be much more certain about some parts than others. Ideally. they could decline sections.
**An interface to interpret & score Squiggle files** **An interface to interpret & score Squiggle files**
Squiggle functions need to be aggregated and scored. This should be done outside one Squiggle file. Maybe this should also be done in Squiggle, or maybe it should be done using Javascript. Squiggle functions need to be aggregated and scored. This should be done outside one Squiggle file. Maybe this should also be done in Squiggle, or maybe it should be done using Javascript.
@ -38,6 +38,9 @@ Of course, we'd also need good math for how the scoring should work, exactly.
This interface should also be able to handle changing Squiggle values. This is because people would be likely to want to update their functions over time, and that should be taken into account for scoring. This interface should also be able to handle changing Squiggle values. This is because people would be likely to want to update their functions over time, and that should be taken into account for scoring.
**Importance & quality scores**
Workflows/functionality to declare the importance and coveredness of each part of the paramater space. For example, some subsets of the paramater space of a function might be much more important to get right than others. Similarly, the analyst might be much more certain about some parts than others. Ideally. they could decline sections.
**Static / Sensitivity Analysis** **Static / Sensitivity Analysis**
Guesstimate has Sensitivity analysis that's pretty useful. This could be quite feasible to add, though it will likely require some thinking. Guesstimate has Sensitivity analysis that's pretty useful. This could be quite feasible to add, though it will likely require some thinking.
@ -47,14 +50,5 @@ It might be useful to allow people to annotate functions and variables with long
**Randomness Seeds** **Randomness Seeds**
Right now, Monte Carlo simulations are totally random. It would be nicer to be able to enter a seed somehow in order to control the randomness. Or, with the same seed, the function should always return the same values. This would make debugging and similar easier. Right now, Monte Carlo simulations are totally random. It would be nicer to be able to enter a seed somehow in order to control the randomness. Or, with the same seed, the function should always return the same values. This would make debugging and similar easier.
## Major Standard Language Features **Caching/Memoization**
There are many performance improvements that Squiggle could have. We'll get to some of them eventually.
- Some testing story.
### Distributions
```js
cauchy();
pareto();
metalog();
```

View File

@ -5,4 +5,5 @@ title: Gallery
- [Adjusting probabilities for the passage of time](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3/p/j8o6sgRerE3tqNWdj) by Nuño Sempere - [Adjusting probabilities for the passage of time](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3/p/j8o6sgRerE3tqNWdj) by Nuño Sempere
- [GiveWell's GiveDirectly cost effectiveness analysis](https://observablehq.com/@hazelfire/givewells-givedirectly-cost-effectiveness-analysis) by Sam Nolan - [GiveWell's GiveDirectly cost effectiveness analysis](https://observablehq.com/@hazelfire/givewells-givedirectly-cost-effectiveness-analysis) by Sam Nolan
- [List of QURI Squiggle Models](https://github.com/quantified-uncertainty/squiggle-models) by Nuño Sempere, Sam Nolan, and Ozzie Gooen
- [Astronomical Waste](https://observablehq.com/@quinn-dougherty/waste) - [Astronomical Waste](https://observablehq.com/@quinn-dougherty/waste)

View File

@ -35,8 +35,7 @@ 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. If this 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)
happens, you can click the "log x scale" box to view this using a log scale.
<SquiggleEditor defaultCode="1 to 10000" /> <SquiggleEditor defaultCode="1 to 10000" />
</TabItem> </TabItem>
</Tabs> </Tabs>
@ -110,6 +109,11 @@ The `mixture` mixes combines multiple distributions to create a mixture. You can
<p> <p>
In this case, I have a 20% chance of spending 0 time with it. I might estimate my hours with, In this case, I have a 20% chance of spending 0 time with it. I might estimate my hours with,
</p> </p>
<Admonition type="caution" title="Caution">
<p>
There's a temporary bug where the below render is compressed. If you toggle the code it will fix render correctly.
</p>
</Admonition>
<SquiggleEditor <SquiggleEditor
defaultCode={`hours_the_project_will_take = 5 to 20 defaultCode={`hours_the_project_will_take = 5 to 20
chance_of_doing_anything = 0.8 chance_of_doing_anything = 0.8
@ -143,8 +147,8 @@ Creates a [normal distribution](https://en.wikipedia.org/wiki/Normal_distributio
<TabItem value="ex1" label="normal(5,1)" default> <TabItem value="ex1" label="normal(5,1)" default>
<SquiggleEditor defaultCode="normal(5, 1)" /> <SquiggleEditor defaultCode="normal(5, 1)" />
</TabItem> </TabItem>
<TabItem value="ex2" label="normal(100000000000, 100000000000)"> <TabItem value="ex2" label="normal(1G, 1G)">
<SquiggleEditor defaultCode="normal(100000000000, 100000000000)" /> <SquiggleEditor defaultCode="normal(1G, 1G)" />
</TabItem> </TabItem>
</Tabs> </Tabs>
@ -280,10 +284,10 @@ Creates a [beta distribution](https://en.wikipedia.org/wiki/Beta_distribution) w
<SquiggleEditor defaultCode="beta(0.8, 0.8)" /> <SquiggleEditor defaultCode="beta(0.8, 0.8)" />
</TabItem> </TabItem>
<TabItem <TabItem
value="from mean and standard deviation" value="ex6"
label="beta({mean: 0.39, stdev: 0.1})" label="beta({mean: 0.39, stdev: 0.1})"
> >
<SquiggleEditor initialSquiggleString="beta({mean: 0.39, stdev: 0.1})" /> <SquiggleEditor defaultCode="beta({mean: 0.39, stdev: 0.1})" />
</TabItem> </TabItem>
</Tabs> </Tabs>
@ -343,7 +347,7 @@ Creates a [triangular distribution](https://en.wikipedia.org/wiki/Triangular_dis
<SquiggleEditor defaultCode="triangular(1, 2, 4)" /> <SquiggleEditor defaultCode="triangular(1, 2, 4)" />
## FromList ## SampleSet.fromList
`SampleSet.fromList(samples:number[])` `SampleSet.fromList(samples:number[])`
@ -367,3 +371,37 @@ Creates a sample set distribution using an array of samples.
specificity. specificity.
</p> </p>
</Admonition> </Admonition>
## PointSet.makeContinuous
`PointSet.makeContinuous(points:{x: number, y: number})`
Creates a continuous point set distribution using a list of points.
<SquiggleEditor defaultCode={`PointSet.makeContinuous([
{ x: 0, y: 0.1 },
{ x: 1, y: 0.2 },
{ x: 2, y: 0.15 },
{ x: 3, y: 0.1 }
])`} />
### Arguments
- `points`: An array of at least 3 coordinates.
## PointSet.makeDiscrete
`PointSet.makeDiscrete(points:{x: number, y: number})`
Creates a discrete point set distribution using a list of points.
<SquiggleEditor defaultCode={`PointSet.makeDiscrete([
{ x: 0, y: 0.1 },
{ x: 1, y: 0.2 },
{ x: 2, y: 0.15 },
{ x: 3, y: 0.1 }
])`} />
### Arguments
- `points`: An array of at least 1 coordinate.

View File

@ -181,7 +181,7 @@ The `sample(distribution)` samples a given distribution.
Recall the [three formats of distributions](https://develop--squiggle-documentation.netlify.app/docs/Discussions/Three-Types-Of-Distributions). We can force any distribution into `SampleSet` format Recall the [three formats of distributions](https://develop--squiggle-documentation.netlify.app/docs/Discussions/Three-Types-Of-Distributions). We can force any distribution into `SampleSet` format
<SquiggleEditor defaultCode="PointSet.fromDist(normal(5, 10))" /> <SquiggleEditor defaultCode="SampleSet.fromDist(normal(5, 10))" />
Or `PointSet` format Or `PointSet` format

View File

@ -64,14 +64,17 @@ You can currently interact with Squiggle in a few ways:
**[Playground](/playground)** **[Playground](/playground)**
The [Squiggle Playground](/playground) is a nice tool for working with small models and making prototypes. You can make simple sharable links, but you can't save models that change over time. The [Squiggle Playground](/playground) is a nice tool for working with small models and making prototypes. You can make simple sharable links, but you can't save models that change over time.
**[Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle)**
There's a simple [VS Code extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) for running and visualizing Squiggle code. We find that VS Code is a useful editor for managing larger Squiggle setups.
**[Typescript Library](https://www.npmjs.com/package/@quri/squiggle-lang)** **[Typescript Library](https://www.npmjs.com/package/@quri/squiggle-lang)**
Squiggle is built using [Rescript](https://rescript-lang.org/), and is accessible via a simple Typescript library. You can use this library to either run Squiggle code in full, or to call select specific functions within Squiggle (though this latter functionality is very minimal). Squiggle is built using [Rescript](https://rescript-lang.org/), and is accessible via a simple Typescript library. You can use this library to either run Squiggle code in full, or to call select specific functions within Squiggle (though this latter functionality is very minimal).
**[React Components Library](https://www.npmjs.com/package/@quri/squiggle-components)** **[React Components Library](https://www.npmjs.com/package/@quri/squiggle-components)**
All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://squiggle-components.netlify.app). All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://squiggle-components.netlify.app).
**[Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle)** **[Observable](https://observablehq.com/@hazelfire/squiggle)**
There's a simple [VS Code extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) for running and visualizing Squiggle code. We find that VS Code is a useful editor for managing larger Squiggle setups. You can use Squiggle Components in Observable notebooks. Sam Nolan put together an exportable [Observable Notebook](https://observablehq.com/@hazelfire/squiggle) of the key components that you can directly important and use in your Observable notebooks.
## Squiggle Vs. Other Tools ## Squiggle Vs. Other Tools
@ -107,13 +110,3 @@ There's a simple [VS Code extension](https://marketplace.visualstudio.com/items?
## 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.
## Get started
- [Gallery](./Discussions/Gallery)
- [Squiggle playground](/playground)
- [Language basics](./Guides/Language)
- [Squiggle functions source of truth](./Guides/Functions)
- [Known bugs](./Discussions/Bugs)
- [Original lesswrong sequence](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3)
- [Author your squiggle models as Observable notebooks](https://observablehq.com/@hazelfire/squiggle)