Skip to content

Commit

Permalink
更新SVM:alphas的优化修改量的求解公式
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzhonglian committed Apr 19, 2017
1 parent 3cb8b37 commit 11a3822
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/python/6.SVM/svm-complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def innerL(i, oS):
return 0

# eta是alphas[j]的最优修改量,如果eta==0,需要退出for循环的当前迭代过程
# 类似:2ab <= a^2 + b^2
# 参考《统计学习方法》李航-P125~P128<序列最小最优化算法>
eta = 2.0 * oS.K[i, j] - oS.K[i, i] - oS.K[j, j] # changed for kernel
if eta >= 0:
print("eta>=0")
Expand Down
2 changes: 1 addition & 1 deletion src/python/6.SVM/svm-complete_Non-Kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def innerL(i, oS):
return 0

# eta是alphas[j]的最优修改量,如果eta==0,需要退出for循环的当前迭代过程
# 类似:2ab <= a^2 + b^2
# 参考《统计学习方法》李航-P125~P128<序列最小最优化算法>
eta = 2.0 * oS.X[i, :] * oS.X[j, :].T - oS.X[i, :] * oS.X[i, :].T - oS.X[j, :] * oS.X[j, :].T
if eta >= 0:
print("eta>=0")
Expand Down
2 changes: 1 addition & 1 deletion src/python/6.SVM/svm-simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def smoSimple(dataMatIn, classLabels, C, toler, maxIter):
continue

# eta是alphas[j]的最优修改量,如果eta==0,需要退出for循环的当前迭代过程
# 类似:2ab <= a^2 + b^2
# 参考《统计学习方法》李航-P125~P128<序列最小最优化算法>
eta = 2.0 * dataMatrix[i, :]*dataMatrix[j, :].T - dataMatrix[i, :]*dataMatrix[i,:].T - dataMatrix[j, :]*dataMatrix[j, :].T
if eta >= 0:
print("eta>=0")
Expand Down

0 comments on commit 11a3822

Please sign in to comment.