| 24小時(shí)熱門(mén)版塊排行榜 |
| 7 | 1/1 | 返回列表 |
| 查看: 2006 | 回復(fù): 6 | ||
[求助]
就是SVM的BPA求解算法。。。≌l(shuí)能給我把這段偽代碼,寫(xiě)成程序。。。
|
|
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時(shí) loTarget = l/(prior0+2) yi為-1時(shí) 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 } 真心求助。 |


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

鐵蟲(chóng) (正式寫(xiě)手)
| 7 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 一志愿西南交大,求調(diào)劑 +4 | 材化逐夢(mèng)人 2026-03-18 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑 ,六級(jí)已過(guò),有科研經(jīng)歷 +10 | 曦熙兮 2026-03-15 | 10/500 |
|
|
[考研] 0703化學(xué)調(diào)劑 +3 | 妮妮ninicgb 2026-03-17 | 3/150 |
|
|
[考研] 生物學(xué)071000 329分求調(diào)劑 +3 | 我愛(ài)生物生物愛(ài)?/a> 2026-03-17 | 3/150 |
|
|
[考研] 290求調(diào)劑 +3 | p asserby. 2026-03-15 | 4/200 |
|
|
[考研] 梁成偉老師課題組歡迎你的加入 +8 | 一鴨鴨喲 2026-03-14 | 10/500 |
|
|
[考研] 一志愿南京大學(xué),080500材料科學(xué)與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研]
|
zhouzhen654 2026-03-16 | 3/150 |
|
|
[基金申請(qǐng)]
今年的國(guó)基金是打分制嗎?
50+3
|
zhanghaozhu 2026-03-14 | 3/150 |
|
|
[考研] 一志愿211 0703方向310分求調(diào)劑 +3 | 努力奮斗112 2026-03-15 | 3/150 |
|
|
[考研] 085600材料與化工 求調(diào)劑 +13 | enenenhui 2026-03-13 | 14/700 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研] 326求調(diào)劑 +3 | mlpqaz03 2026-03-15 | 3/150 |
|
|
[考研]
|
笨笨兔子 2026-03-12 | 3/150 |
|
|
[考研] 288求調(diào)劑 +4 | 奇點(diǎn)0314 2026-03-14 | 4/200 |
|
|
[考研] 本科南京大學(xué)一志愿川大藥學(xué)327 +3 | 麥田耕者 2026-03-14 | 3/150 |
|
|
[考研] 290求調(diào)劑 +7 | ADT 2026-03-12 | 7/350 |
|
|
[考研] 一志愿山大07化學(xué) 332分 四六級(jí)已過(guò) 本科山東雙非 求調(diào)劑! +3 | 不想理你 2026-03-12 | 3/150 |
|
|
[考研] 081200-11408-276學(xué)碩求調(diào)劑 +3 | 崔wj 2026-03-12 | 4/200 |
|