SkillAgentSearch skills...

Rtnorm

Sampling truncated univ normal distribution

Install / Use

/learn @JonasWallin/Rtnorm
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

rtnorm

Sampling truncated univ normal distribution.

This repos contains python and matlab package for simulation of truncated normal random variables based upon the codes: Vincent Mazet, and it built from the article Fast simulation of trunacted Gaussian distributions of Niclos Chopin.

Python

For python the requirements are:

  • scipy (will be removed)

  • NumPy

  • Cython

  • openmp (option can be turned off in setupy.py)

      pip -e 'git+https://git@github.com/JonasWallin/rtnorm.git#egg=rtnorm&subdirectory=python/rtnorm' 
    

To use the sampler:

import rtnorm
sampler = rtnorm.rtnorm()
X = sampler(a = 1, b = 2, mu = 3, sigma = 4)

Or with vectors:

import rtnorm
import numpy as np
X = sampler( a = np.zeros((4,)), b = np.random.rand(4) )

Matlab

For matlab:

make 

should install the make mex files link to the directory with addpath. Run matlab code with:

x = rtnorm(a, b, mu, sigma);

where a,b,mu, and sigma are vectors

###TODO:

1. setup test case  in python (done)
2. setup speed test in python (done)
3. modify the code so it sutiable for vector versions (done)
4. Write the probability so we can test more advanced 
5. Matlab version (done)
7. test on the amzaon cluster (done)

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated5y ago
Forks1

Languages

C++

Security Score

70/100

Audited on May 10, 2020

No findings