pbharrin/machinelearninginaction

ch06 svm selectJ

yiyunchen opened this issue · 1 comments

May I ask about the
"Ek = calcEk(oS, k)"
in the selectJ function,

why not just use the Ek calculated in eCache.

I think there's bug in the complete version of SMO implementation. First, I wanna say the code provided by the author really sucks and is definitely not pythonic. For example, we rarely use from numpy import * and np.array is recommended (even by the official document) instead of the matrix structure. I want to point out some of the problems in the svm-complete.py code:

  1. The author uses a matrix of size m by 2 to store a flag bit and the calculated value Ek. However, the calculated value Ek is never used.
  2. Second, I try to run both the simple and complete version of the SMO, but they don't yield the same results. The simple version seems to be correct while the complete version doesn't give the best decision boundary. One may argue that it could be due to the randomness of the algorithm. But I think there's a flaw in the implementation.
  3. After some google search, I find out there's better way to choose alphas, which was proposed in the paper by RE Fan in 2005 and was in fact implemented in official libsvm library.