正在加载图片...
target desired output vector point training point matrix procedure takestep(i1,i2) if (i1 ==i2)return 0 alph1=Lagrange multiplier for il y1 target[i1] E1 SVM output on point[i1]-y1 (check in error cache) s yl*y2 Compute L,H via equations (13)and (14) if (L ==H) return 0 k11 kernel(point [i1],point [i1]) k12 kernel(point[i1],point [i2]) k22 kernel(point [i2],point [i2]) eta=k11+k22-2*k12 if (eta 0) a2 alph2 y2*(E1-E2)/eta f(a2<1)a2=L else if (a2 H)a2 =H else Lobj objective function at a2=L Hobj objective function at a2=H if (Lobj Hobj-eps) a2 L else if (Lobj Hobj+eps) a2 H else a2 alph2 if (la2-alph2I eps*(a2+alph2+eps)) return 0 al alph1+s*(alph2-a2) Update threshold to reflect change in Lagrange multipliers Update weight vector to reflect change in al a2,if SVM is linear Update error cache using new Lagrange multipliers Store al in the alpha array store a2 in the alpha array return 1 endprocedure procedure examineExample(i2) y2 target[i2] alph2 Lagrange multiplier for i2 E2 SVM output on point[i2]-y2 (check in error cache) x2=E2*y2 if ((r2 <-tol &alph2 C)II (r2 tol &alph2 >0)) if (number of non-zero non-c alpha 1) { il result of second choice heuristic (section 2.2) if takestep(i1,i2) return 1 1010 target = desired output vector point = training point matrix procedure takeStep(i1,i2) if (i1 == i2) return 0 alph1 = Lagrange multiplier for i1 y1 = target[i1] E1 = SVM output on point[i1] – y1 (check in error cache) s = y1*y2 Compute L, H via equations (13) and (14) if (L == H) return 0 k11 = kernel(point[i1],point[i1]) k12 = kernel(point[i1],point[i2]) k22 = kernel(point[i2],point[i2]) eta = k11+k22-2*k12 if (eta > 0) { a2 = alph2 + y2*(E1-E2)/eta if (a2 < L) a2 = L else if (a2 > H) a2 = H } else { Lobj = objective function at a2=L Hobj = objective function at a2=H if (Lobj < Hobj-eps) a2 = L else if (Lobj > Hobj+eps) a2 = H else a2 = alph2 } if (|a2-alph2| < eps*(a2+alph2+eps)) return 0 a1 = alph1+s*(alph2-a2) Update threshold to reflect change in Lagrange multipliers Update weight vector to reflect change in a1 & a2, if SVM is linear Update error cache using new Lagrange multipliers Store a1 in the alpha array Store a2 in the alpha array return 1 endprocedure procedure examineExample(i2) y2 = target[i2] alph2 = Lagrange multiplier for i2 E2 = SVM output on point[i2] – y2 (check in error cache) r2 = E2*y2 if ((r2 < -tol && alph2 < C) || (r2 > tol && alph2 > 0)) { if (number of non-zero & non-C alpha > 1) { i1 = result of second choice heuristic (section 2.2) if takeStep(i1,i2) return 1 }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有