Weighted matrix factorization in Python