Which algorithm has a better performance in terms of time complexity, LDA or KNN?

  • $\begingroup$ This seems like it should be perfectly answerable to me. $\endgroup$ Commented May 6, 2016 at 10:55

1 Answer 1


Time complexity depends on the number of data and features.

LDA time complexity is $O\left(Nd^{2}\right)$ if $N>d$, otherwise it's $O\left(d^{3}\right)$ (see this question and answer). It's mostly contained in the training phase, as you have to find the within class variance.

k-NN time complexity is $O\left(Nd\right)$. Actually, training without preprocessing is instantaneous (check this book), testing takes most time as you have to compare each test instance to most (or even the whole) training data.

Said that, without any other optmizations, k-NN should run incrementally faster than LDA as you add more dimensions to your problem.

Also, k-NN time complexity is pretty much insensitive to the number of classes in most implementations. LDA on the other hand has a direct dependence on that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.