Sparse coding implemented in python