https://github.com/limix/liknorm-py
Liknorm Python wrapper.
https://github.com/limix/liknorm-py
Last synced: about 1 month ago
JSON representation
Liknorm Python wrapper.
- Host: GitHub
- URL: https://github.com/limix/liknorm-py
- Owner: limix
- License: mit
- Created: 2017-03-04T20:27:33.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2025-01-07T14:06:15.000Z (4 months ago)
- Last Synced: 2025-03-29T10:24:17.916Z (about 2 months ago)
- Language: Python
- Size: 194 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# liknorm-py
Liknorm Python wrapper.
## Install
It can be done via [pip](https://pypi.org/) or [conda](https://conda.io/).
### Pip
```bash
pip install liknorm
```### Conda
```bash
conda install -c conda-forge liknorm-py
```## Running the tests
After installation, you can test it
```bash
python -c "import liknorm; liknorm.test()"
```as long as you have [pytest](http://docs.pytest.org/en/latest/).
## Example
```python
>>> 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
* [Danilo Horta](https://github.com/horta)
## License
This project is licensed under the
[MIT License](https://raw.githubusercontent.com/limix/liknorm-py/master/LICENSE.md).