Implementation of LDA algo