Implementing linear discriminant analysis (LDA) in Python