Skip to main content

Sinkhorn-Knopp Algorithm

Project description

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.

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.1.tar.gz (3.9 kB view hashes)

Uploaded Source

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