skip to navigation
skip to content

liknorm 1.0.12

Liknorm Python wrapper

Liknorm Python wrapper.

Install

The recommended way of installing it is via conda

conda install -c conda-forge liknorm-py

An alternative way would be via pip. First you need to install liknorm library and then

pip install liknorm-py

Running the tests

After installation, you can test it

python -c "import liknorm; liknorm.test()"

as long as you have pytest.

Example

>>> from numpy import empty
>>> from numpy.random import RandomState
>>> from liknorm import LikNormMachine
>>>
>>> machine = LikNormMachine('bernoulli')
>>> random = RandomState(0)
>>> outcome = random.randint(0, 2, 5)
>>> tau = random.rand(5)
>>> eta = random.randn(5) * tau
>>>
>>> log_zeroth = empty(5)
>>> mean = empty(5)
>>> variance = empty(5)
>>>
>>> moments = {'log_zeroth': log_zeroth, 'mean': mean, 'variance': variance}
>>> machine.moments(outcome, eta, tau, moments)
>>>
>>> print('%.3f %.3f %.3f' % (log_zeroth[0], mean[0], variance[0]))
-0.671 -0.515 0.946

Authors

License

This project is licensed under the MIT License - see the license file for details.

 
File Type Py Version Uploaded on Size
liknorm-1.0.12-cp27-cp27m-macosx_10_11_x86_64.whl (md5) Python Wheel cp27 2017-10-03 12KB
liknorm-1.0.12-cp36-cp36m-macosx_10_11_x86_64.whl (md5) Python Wheel cp36 2017-10-03 12KB
liknorm-1.0.12.tar.gz (md5) Source 2017-10-03 6KB