Skip to content

btaba/sinkhorn_knopp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sinkhorn_knopp

Build Status

To convert non-negative square matrices with total support into doubly stochastic matrices.

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

pip install sinkhorn_knopp

or

git clone https://github.com/btaba/sinkhorn_knopp
cd sinkhorn_knopp
python setup.py install

Uninstall

Depending on the above, either:

pip uninstall sinkhorn_knopp

or

cd sinkhorn_knopp
python setup.py install --record files.txt
cat files.txt | xargs rm -rf

About

python implementation of Sinkhorn-Knopp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages