LDA: Refactor code to eliminate a distribution bug

Other change:
- Distributing the model by doc_id instead of randomly to improve
convergence rate