| 7 | 1/1 | 返回列表 |
| 查看: 2005 | 回復(fù): 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時(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 } 真心求助。 |


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

鐵蟲 (正式寫手)
| 7 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0703化學(xué) 305求調(diào)劑 +4 | FY_yy 2026-03-14 | 4/200 |
|
|---|---|---|---|---|
|
[考研] 0703化學(xué)調(diào)劑,求各位老師收留 +10 | 秋有木北 2026-03-14 | 10/500 |
|
|
[考研] 281求調(diào)劑(0805) +6 | 煙汐憶海 2026-03-16 | 16/800 |
|
|
[考研] 求材料調(diào)劑 +8 | 隔壁陳先生 2026-03-12 | 8/400 |
|
|
[考研] 一志愿華中科技大學(xué),080502,354分求調(diào)劑 +4 | 守候夕陽CF 2026-03-18 | 4/200 |
|
|
[考研] 311求調(diào)劑 +4 | 冬十三 2026-03-18 | 4/200 |
|
|
[教師之家] 焦慮 +8 | 水冰月月野兔 2026-03-13 | 12/600 |
|
|
[考研] 311求調(diào)劑 +6 | 26研0 2026-03-15 | 6/300 |
|
|
[考研] 0854可跨調(diào)劑,一作一項(xiàng)核心論文五項(xiàng)專利,省、國(guó)級(jí)證書40+數(shù)一英一287 +8 | 小李0854 2026-03-16 | 8/400 |
|
|
[考研] 304求調(diào)劑 +12 | 小熊joy 2026-03-14 | 13/650 |
|
|
[考研] 環(huán)境工程調(diào)劑 +8 | 大可digkids 2026-03-16 | 8/400 |
|
|
[考研] 301求調(diào)劑 +4 | A_JiXing 2026-03-16 | 4/200 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研] 一志愿華中師范071000,325求調(diào)劑 +6 | RuitingC 2026-03-12 | 6/300 |
|
|
[基金申請(qǐng)] 現(xiàn)在如何回避去年的某一個(gè)專家,不知道名字 +3 | zk200107 2026-03-12 | 6/300 |
|
|
[考研] [0860]321分求調(diào)劑,ab區(qū)皆可 +4 | 寶貴熱 2026-03-13 | 4/200 |
|
|
[考研] 329求調(diào)劑 +3 | miaodesi 2026-03-12 | 4/200 |
|
|
[考研] 311求調(diào)劑 +3 | 冬十三 2026-03-13 | 3/150 |
|
|
[考研] 材料專碩350 求調(diào)劑 +4 | 王金科 2026-03-12 | 4/200 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +8 | 困于星晨 2026-03-12 | 10/500 |
|