Sinkhorn-Knopp Algorithm
Project description
sinkhorn_knopp
--------
[![Build Status](https://travis-ci.org/btaba/sinkhorn_knopp.svg?branch=master)](https://travis-ci.org/btaba/sinkhorn_knopp)
To convert non-negative square matrices with total support into doubly stochastic matrices.
```python
>> import numpy as np
>> from sinkhorn_knopp import sinkhorn_knopp as skp
>> sk = skp.SinkhornKnopp()
>> P = [[.011, .15], [1.71, .1]]
>> P_ds = sk.fit(P)
>> print P_ds
[[ 0.06102561 0.93897439]
[ 0.93809928 0.06190072]]
>> print np.sum(P_ds, axis=0)
[ 0.99912489 1.00087511]
>> print np.sum(P_ds, axis=1)
[ 1., 1.]
```
See http://msp.org/pjm/1967/21-2/pjm-v21-n2-p14-s.pdf for reference.
## Install
Either:
```sh
pip install sinkhorn_knopp
```
or
```sh
git clone https://github.com/btaba/sinkhorn_knopp
cd sinkhorn_knopp
python setup.py install
```
## Uninstall
Depending on the above, either:
```sh
pip uninstall sinkhorn_knopp
```
or
```sh
cd sinkhorn_knopp
python setup.py install --record files.txt
cat files.txt | xargs rm -rf
```
--------
[![Build Status](https://travis-ci.org/btaba/sinkhorn_knopp.svg?branch=master)](https://travis-ci.org/btaba/sinkhorn_knopp)
To convert non-negative square matrices with total support into doubly stochastic matrices.
```python
>> import numpy as np
>> from sinkhorn_knopp import sinkhorn_knopp as skp
>> sk = skp.SinkhornKnopp()
>> P = [[.011, .15], [1.71, .1]]
>> P_ds = sk.fit(P)
>> print P_ds
[[ 0.06102561 0.93897439]
[ 0.93809928 0.06190072]]
>> print np.sum(P_ds, axis=0)
[ 0.99912489 1.00087511]
>> print np.sum(P_ds, axis=1)
[ 1., 1.]
```
See http://msp.org/pjm/1967/21-2/pjm-v21-n2-p14-s.pdf for reference.
## Install
Either:
```sh
pip install sinkhorn_knopp
```
or
```sh
git clone https://github.com/btaba/sinkhorn_knopp
cd sinkhorn_knopp
python setup.py install
```
## Uninstall
Depending on the above, either:
```sh
pip uninstall sinkhorn_knopp
```
or
```sh
cd sinkhorn_knopp
python setup.py install --record files.txt
cat files.txt | xargs rm -rf
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sinkhorn_knopp-0.2.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for sinkhorn_knopp-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d40b3ad2848aecdf60b021ca0179ae64ce5fad87d39eab1b6e679a0a8f8eb96b |
|
MD5 | 15022af4c6dc151e48033698c7d90811 |
|
BLAKE2b-256 | 4a10e53ddd706975d98b25c84e721e6a506297992a51f75bffca4b6f159aefa8 |