Skip to main content

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
```

Project details


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)

Uploaded Source

Built Distribution

sinkhorn_knopp-0.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page