| 2 | 1/1 | 返回列表 |
| 查看: 790 | 回復(fù): 1 | ||
tuburfransth金蟲 (正式寫手)
|
[求助]
關(guān)于支持向量機(jī)的SMO算法偽代碼中有一些問題請教大家 已有1人參與
|
|
CODE: 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 } loop over all non-zero and non-C alpha, starting at a random point { i1 = identity of current alpha if takeStep(i1,i2) return 1 } loop over all possible i1, starting at a random point { i1 = loop variable if (takeStep(i1,i2) return 1 } } return 0 endprocedure main routine: numChanged = 0; examineAll = 1; while (numChanged > 0 | examineAll) { numChanged = 0; if (examineAll) loop I over all training examples numChanged += examineExample(I) else loop I over examples where alpha is not 0 & not C numChanged += examineExample(I) if (examineAll == 1) examineAll = 0 else if (numChanged == 0) examineAll = 1 } 代碼見上方,我想請教代碼中的return 0和return 1執(zhí)行后有什么結(jié)果?還有E1 = SVM output on point[i1] – y1 (check in error cache)這行代碼怎么理解? |
| 2 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 271求調(diào)劑 +5 | 勒布朗@ 2026-03-31 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 求調(diào)劑 +8 | 11ggg 2026-03-30 | 8/400 |
|
|
[考研] 284求調(diào)劑 +7 | 小熊~~ 2026-03-31 | 7/350 |
|
|
[考研] 287求調(diào)劑 +17 | land xuxu 2026-03-26 | 17/850 |
|
|
[考研] 313求調(diào)劑 +6 | 賣個(gè)關(guān)子吧 2026-03-31 | 6/300 |
|
|
[考研] 一志愿 南京航空航天大學(xué) ,080500材料科學(xué)與工程學(xué)碩 +5 | @taotao 2026-03-30 | 5/250 |
|
|
[考研] 085601一志愿中山大學(xué)深圳材料工程330求調(diào)劑 +5 | pipiver 2026-03-30 | 5/250 |
|
|
[考研] 332求調(diào)劑 +14 | 032500 2026-03-25 | 14/700 |
|
|
[考研] 一志愿南開大學(xué)0710生物學(xué)359求調(diào)劑 +5 | 兔兔兔111223314 2026-03-29 | 7/350 |
|
|
[考研] 337求調(diào)劑 +6 | 《樹》 2026-03-29 | 6/300 |
|
|
[考研] 349求調(diào)劑 +6 | 李木子啊哈哈 2026-03-25 | 6/300 |
|
|
[考研] 數(shù)一英一271專碩(085401)求調(diào)劑,可跨 +7 | 前行必有光 2026-03-28 | 8/400 |
|
|
[考研] 085602 化工專碩 338分 求調(diào)劑 +12 | 路癡小琪 2026-03-27 | 12/600 |
|
|
[考研] 312,生物學(xué)求調(diào)劑 +3 | 小譯同學(xué)abc 2026-03-28 | 3/150 |
|
|
[考研]
|
y7czhao 2026-03-26 | 10/500 |
|
|
[考研] 299求調(diào)劑 +7 | 嗯嗯嗯嗯2 2026-03-27 | 7/350 |
|
|
[考研] 285求調(diào)劑 +4 | AZMK 2026-03-27 | 7/350 |
|
|
[考研] 085600,材料與化工321分,求調(diào)劑 +9 | 大饞小子 2026-03-27 | 9/450 |
|
|
[考研]
|
平樂樂樂 2026-03-26 | 4/200 |
|
|
[考研] 309求調(diào)劑 +4 | gajsj 2026-03-25 | 5/250 |
|