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吧。。。