| 5 | 1/1 | 返回列表 |
| 查看: 2009 | 回復: 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ā)表 | |
|---|---|---|---|---|
|
[考研] 328求調(diào)劑,英語六級551,有科研經(jīng)歷 +4 | 生物工程調(diào)劑 2026-03-16 | 12/600 |
|
|---|---|---|---|---|
|
[考研] 一志愿西安交通大學材料工程專業(yè) 282分求調(diào)劑 +5 | 楓橋ZL 2026-03-18 | 5/250 |
|
|
[考研] 285化工學碩求調(diào)劑(081700) +11 | 柴郡貓_ 2026-03-12 | 11/550 |
|
|
[考研] 085601專碩,總分342求調(diào)劑,地區(qū)不限 +5 | share_joy 2026-03-16 | 5/250 |
|
|
[考研] 297求調(diào)劑 +8 | 戲精丹丹丹 2026-03-17 | 8/400 |
|
|
[考研] 331求調(diào)劑(0703有機化學 +7 | ZY-05 2026-03-13 | 8/400 |
|
|
[考研] 070300化學319求調(diào)劑 +6 | 錦鯉0909 2026-03-17 | 6/300 |
|
|
[考研] 302求調(diào)劑 +10 | 呼呼呼。。。。 2026-03-17 | 10/500 |
|
|
[考研] 288求調(diào)劑,一志愿華南理工大學071005 +4 | ioodiiij 2026-03-17 | 4/200 |
|
|
[考研]
|
胡辣湯放糖 2026-03-15 | 6/300 |
|
|
[考研] 材料,紡織,生物(0856、0710),化學招生啦 +3 | Eember. 2026-03-17 | 9/450 |
|
|
[考研] 生物學071000 329分求調(diào)劑 +3 | 我愛生物生物愛?/a> 2026-03-17 | 3/150 |
|
|
[考研] 307求調(diào)劑 +3 | 冷笙123 2026-03-17 | 3/150 |
|
|
[考研] 環(huán)境工程調(diào)劑 +8 | 大可digkids 2026-03-16 | 8/400 |
|
|
[考研] 302求調(diào)劑 +4 | 小賈同學123 2026-03-15 | 8/400 |
|
|
[考研] 0703 物理化學調(diào)劑 +3 | 我可以上岸的對?/a> 2026-03-13 | 5/250 |
|
|
[考研] 26考研一志愿中國石油大學(華東)305分求調(diào)劑 +3 | 嘉年新程 2026-03-15 | 3/150 |
|
|
[考研] [0860]321分求調(diào)劑,ab區(qū)皆可 +4 | 寶貴熱 2026-03-13 | 4/200 |
|
|
[考研] 26調(diào)劑/材料科學與工程/總分295/求收留 +9 | 2026調(diào)劑俠 2026-03-12 | 9/450 |
|
|
[碩博家園] 085600 260分求調(diào)劑 +3 | 天空還下雨么 2026-03-13 | 5/250 |
|