-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling random variables #95
Comments
I have been thinking that that instead of introducing a <ConnectionRule name="MeaninglessExample">
<Parameter name="variance" dimension="length"/>
<Select action="add">
<Mask>...</Mask>
<Select action="add">
<Number>
<MathInline>ceil(number)</MathInline>
</Number>
<RandomSample>
<Reference name="number"/>
</RandomSample>
<Select action="remove">
<Number>
<MathInline>20 - ceil(number)</MathInline>
</Number>
</Select>
</Select>
</Select>
<Alias name="scaled_variance">
<MathInline>variance/one_um</MathInline>
</Alias>
<RandomVariable name="number" units="um">
<un:NormalDistribution xmlns:un="http://uncertml.org">
<un:mean>0.0</un.mean>
<un:variance>scaled_variance</un.variance>
</un:NormalDistribution>
</RandomVariable>
<Constant name="one_um" value="1.0" units="um"/>
</ConnectionRule> It would be invalid to refer to a random variable that has not been drawn in the current or parent scopes, and it would be also invalid to draw a value in a nested scope that has already been drawn in one of its parents. This format it could then handle the rejection of random samples with something like <ConnectionRule name="AnotherMeaninglessExample">
<Parameter name="variance" dimension="length"/>
<PropertyReceivePort name="src_x" dimension="length" container="source"/>
<PropertyReceivePort name="src_y" dimension="length" container="source"/>
<Select action="add" perspective="source">
<Mask>
<MathInline>src_x < x && src_y < y</MathInline>
</Mask>
<RandomSample>
<Reference name="x"/>
<Reference name="y"/>
<Reject>
<MathInline>x*x + y*y > 2*variance</MathInline>
</Reject>
</RandomSample>
</Select>
<Alias name="scaled_variance">
<MathInline>variance/one_um</MathInline>
</Alias>
<RandomVariable name="x" units="um">
<un:NormalDistribution xmlns:un="http://uncertml.org">
<un:mean>0.0</un.mean>
<un:variance>scaled_variance</un.variance>
</un:NormalDistribution>
</RandomVariable>
<RandomVariable name="y" units="um">
<un:NormalDistribution xmlns:un="http://uncertml.org">
<un:mean>0.0</un.mean>
<un:variance>scaled_variance</un.variance>
</un:NormalDistribution>
</RandomVariable>
<Constant name="one_um" value="1.0" units="um"/>
</ConnectionRule> |
Andrew raised the issue in the meeting that many neuroscience models (unwisely) redraw negative tails of normally distributed random variables, and we didn’t have a way to do this in the current spec. While this use case is not recommended we want to be able to represent legacy models, and there other cases where this is a good idea. For example, if you want to sample uniformly distributed points on a disc/ball/etc… the easiest way to do this is to uniformly sample from a square and throw away the points that are outside the disc.
In order to handle these cases I have come up with the following syntax for redrawing random variables on some rejection condition.
or for the negative tails of normal distributions
Let me know what you think
The text was updated successfully, but these errors were encountered: