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 details)
Built Distribution
File details
Details for the file sinkhorn_knopp-0.2.tar.gz
.
File metadata
- Download URL: sinkhorn_knopp-0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fbfb658c1d85320071f2f893b25eef853cf5d2dd9bd8d2c9af880c52c356040 |
|
MD5 | 4de7791cfddda136ddc7f950e7cc057b |
|
BLAKE2b-256 | a7fbf1654100121230fb127bad6063ded3031c44b242293553f5c89d8154365e |
Provenance
File details
Details for the file sinkhorn_knopp-0.2-py3-none-any.whl
.
File metadata
- Download URL: sinkhorn_knopp-0.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d40b3ad2848aecdf60b021ca0179ae64ce5fad87d39eab1b6e679a0a8f8eb96b |
|
MD5 | 15022af4c6dc151e48033698c7d90811 |
|
BLAKE2b-256 | 4a10e53ddd706975d98b25c84e721e6a506297992a51f75bffca4b6f159aefa8 |