master
Boris Glavic 2020-07-01 18:53:45 -05:00
parent f832972cde
commit f3dad74848
1 changed files with 13 additions and 13 deletions

View File

@ -83,7 +83,7 @@ CREATE TABLE my_probabilistic_data(
);
INSERT INTO my_probabilistic_data
SELECT input.name,
CREATE_VARIABLE("Normal", vector(input.mean, input.stddev))
CREATE_VARIABLE("Normal", ROW(input.mean, input.stddev))
FROM input;
</pre>
This example creates a random variable by iterating over each row of the table 'input'. The Normal distribution requires two parameters: a mean and a standard deviation, both of which are drawn from the corresponding row of the input table.<p>
@ -194,23 +194,23 @@ FROM results;</pre>
<h2><a name="reference_dist_list">Reference: Predefined Distributions</a></h2>
<dt>Zero</dt>
<dd>A distribution that is always zero (i.e., the <a href="http://en.wikipedia.org/wiki/Dirac_delta">Dirac Delta</a> as a distribution).
<pre>CREATE_VARIABLE("Zero", vector())</pre></dd>
<pre>CREATE_VARIABLE("Zero", ROW())</pre></dd>
<dt>Exponential</dt>
<dd><a href="http://en.wikipedia.org/wiki/Exponential_distribution">The Exponential Distribution</a>. The Exponential Distribution takes one parameter, lambda: the <b>inverse</b> of the expectation of the variable being created.
<pre>CREATE_VARIABLE("Exponential", vector(lambda))</pre></dd>
<pre>CREATE_VARIABLE("Exponential", ROW(lambda))</pre></dd>
<dt>Normal</dt>
<dd><a href="http://en.wikipedia.org/wiki/Normal_distribution">The Normal Distribution</a>. The Normal Distribution takes two parameters, the mean, and the standard deviation of the variable being created.
<pre>CREATE_VARIABLE("Normal", vector(mean, stddev))</pre></dd>
<pre>CREATE_VARIABLE("Normal", ROW(mean, stddev))</pre></dd>
<dt>Poisson</dt>
<dd><a href="http://en.wikipedia.org/wiki/Poisson_distribution">The Poisson Distribution</a>. The Poisson distribution takes one parameter, lambda: the expectation of the variable being created.
<pre>CREATE_VARIABLE("Poisson", vector(lambda))</pre></dd>
<pre>CREATE_VARIABLE("Poisson", ROW(lambda))</pre></dd>
<dt>Uniform</dt>
<dd><a href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)">The Uniform Distribution</a>. The uniform distribution takes two parameters, the endpoints of the distribution; The endpoints may be provided in any order.
<pre>CREATE_VARIABLE("Uniform", vector(low, high))</pre></dd>
<pre>CREATE_VARIABLE("Uniform", ROW(low, high))</pre></dd>
</dl>
<hr />
@ -230,7 +230,7 @@ The components of a PIP distribution are as follows:
<dt><code>init_fn</code></dt>
<dd>A pointer to a constructor function for your distribution with the following schema:<pre>
void init_fn(pip_var *var, HeapTupleHeader params)</pre>
When your initializer is invoked, <code>var</code> will contain a pointer to initialized pip variable. <code>var->group_state</code> will contain a pointer to an allocated, but uninitialized block of [paramsize] bytes. <code>params</code> is a pointer to the postgres vector() of parameters. See below for information on utility functions for parsing the parameter vector.</dd>
When your initializer is invoked, <code>var</code> will contain a pointer to initialized pip variable. <code>var->group_state</code> will contain a pointer to an allocated, but uninitialized block of [paramsize] bytes. <code>params</code> is a pointer to the postgres ROW() of parameters. See below for information on utility functions for parsing the parameter vector.</dd>
<dt><code>gen_fn</code></dt>
<dd>A pointer to a generator function for your distribution with the following schema: <pre>