1,处理指数计算问题时,为了防止overflow 的处理方法(我还是存在疑问,这相当与求超级大的数的导数):
f = np.array([123, 456, 789]) # example with 3 classes and each having large scores
p = np.exp(f) / np.sum(np.exp(f)) # Bad: Numeric problem, potential blowup
# instead: first shift the values of f so that the highest number is 0:
f -= np.max(f) # f becomes [-666, -333, 0]
p = np.exp(f) / np.sum(np.exp(f)) # safe to do, gives the correct answer
2,关于LR为凸函数,可以保证最值(中科大面试时被问到)???
3,svm的代码复现,看了很多遍svm的思路,也被面试问到过svm,不如尝试复现一次或者trvarse吧。。。