| 5 | 1/1 | 返回列表 |
| 查看: 2007 | 回復: 6 | ||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||
[求助]
就是SVM的BPA求解算法。。!誰能給我把這段偽代碼,寫成程序。。。
|
||
|
This appendix shows the pseudo-code for the training is shown below. The algorithm is a model-trust algorithm based on the Levenberg-Marquardt algorithm [17]. Input parameters: out = array of SVM outputs SVM的輸出 target = array of booleans: is ith example a positive example?(0,1) priorl = number of positive examples prior0 = number of negative examples Outputs: A, B = parameters of sigmoid A = 0 B = log((prior0+l)/(priorl+l)) hiTarget = (priorl+l)/(priorl+2) yi為+1時 loTarget = l/(prior0+2) yi為-1時 lambda = le-3 olderr = le300 pp = temp array to store current estimate of probability of examples set all pp array elements to (priorl+l)/(prior0+priorl+2) count = 0 for it = l to l00 { a = 0, b = 0, c = 0, d = 0, e = 0 // First, compute Hessian & gradient of error function // with respect to A & B for i = l to len { if (target) t = hiTarget else t = loTarget dl = pp-t d2 = pp*(l-pp) a += out*out*d2 b += d2 c += out*d2 d += out*dl e += dl } // If gradient is really tiny, then stop if (abs(d) < 1e-9 && abs(e) < 1e-9) break oldA = A oldB = B err = 0 // Loop until goodness of fit increases while (1) { det = (a+lambda)*(b+lambda)-c*c if (det == 0) { // if determinant of Hessian is zero, // increase stabilizer lambda *= 10 continue } A = oldA + ((b+lambda)*d-c*e)/det B = oldB + ((a+lambda)*e-c*d)/det // Now, compute the goodness of fit err = 0; for i = 1 to len { p = 1/(1+exp(out*A+B)) pp = p // At this step, make sure log(0) returns -200 err -= t*log(p)+(1-t)*log(1-p) } if (err < olderr*(1+1e-7)) { lambda *= 0.1 break } // error did not decrease: increase stabilizer by factor of 10 // & try again lambda *= 10 if (lambda >= 1e6) // something is broken. Give up break } diff = err-olderr scale = 0.5*(err+olderr+1) if (diff > -1e-3*scale && diff < 1e-7*scale) count++ else count = 0 olderr = err if (count == 3) break } 真心求助。 |


鐵桿木蟲 (文壇精英)
very good

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 285化工學碩求調(diào)劑(081700) +11 | 柴郡貓_ 2026-03-12 | 11/550 |
|
|---|---|---|---|---|
|
[考研] 0703化學調(diào)劑 +8 | 妮妮ninicgb 2026-03-15 | 12/600 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +5 | hanamiko 2026-03-18 | 5/250 |
|
|
[考研] 311求調(diào)劑 +11 | 冬十三 2026-03-15 | 12/600 |
|
|
[考研] 材料,紡織,生物(0856、0710),化學招生啦 +3 | Eember. 2026-03-17 | 9/450 |
|
|
[考研] 生物學071000 329分求調(diào)劑 +3 | 我愛生物生物愛?/a> 2026-03-17 | 3/150 |
|
|
[考研] 326求調(diào)劑 +5 | 上岸的小葡 2026-03-15 | 6/300 |
|
|
[考研] 本人考085602 化學工程 專碩 +16 | 不知道叫什么! 2026-03-15 | 18/900 |
|
|
[考研] 有沒有道鐵/土木的想調(diào)劑南林,給自己招師弟中~ +3 | TqlXswl 2026-03-16 | 7/350 |
|
|
[考研] 211本,11408一志愿中科院277分,曾在中科院自動化所實習 +6 | Losir 2026-03-12 | 7/350 |
|
|
[考研] 一志愿南京大學,080500材料科學與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研] 278求調(diào)劑 +3 | Yy7400 2026-03-13 | 3/150 |
|
|
[考研] [導師推薦]西南科技大學國防/材料導師推薦 +3 | 尖角小荷 2026-03-16 | 6/300 |
|
|
[考研] 304求調(diào)劑 +4 | ahbd 2026-03-14 | 4/200 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研] 326求調(diào)劑 +3 | mlpqaz03 2026-03-15 | 3/150 |
|
|
[考研] 22408總分284求調(diào)劑 +3 | InAspic 2026-03-13 | 3/150 |
|
|
[考研] 中科大材料與化工319求調(diào)劑 +3 | 孟鑫材料 2026-03-14 | 3/150 |
|
|
[考研] 材料與化工 323 英一+數(shù)二+物化,一志愿:哈工大 本人本科雙一流 +4 | 自由的_飛翔 2026-03-13 | 5/250 |
|
|
[考研] 304求調(diào)劑 +7 | 7712b 2026-03-13 | 7/350 |
|