Adapted bernoulli mixture model to handling sparse matrices.

- Needs a lot more testing though.