甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満

Posted 鏈哄櫒瀛︿範AI绠楁硶宸ョ▼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満相关的知识,希望对你有一定的参考价值。


鍚慉I杞瀷鐨勭▼搴忓憳閮藉叧娉ㄤ簡杩欎釜鍙?/span>馃憞馃憞馃憞


What's the SVM?

^_^ 棣栧厛锛屾敮鎸佸悜閲忔満涓嶆槸涓€绉嶆満鍣紝鑰屾槸涓€绉嶆満鍣ㄥ涔犵畻娉曘€?/p>

1銆丼VM - Support Vector Machine 锛屼織绉版敮鎸佸悜閲忔満锛屾槸涓€绉?supervised learning 锛堢洃鐫e涔狅級绠楁硶锛屽睘浜?classification 锛堝垎绫伙級鐨勮寖鐣淬€?/p>

2銆佸湪鏁版嵁鎸栨帢鐨勫簲鐢ㄤ腑锛屼笌 unsupervised learning 锛堟棤鐩戠潱瀛︿範锛夌殑 Clustering锛堣仛绫伙級鐩稿搴斿拰鍖哄埆銆?/p>

3銆佸箍娉涘簲鐢ㄤ簬 Machine Learning 锛堟満鍣ㄥ涔狅級锛孋omputer Vision 锛堣绠楁満瑙嗚锛岃閫间竴鐐硅锛屽氨鏄?cv锛夊拰 Data Mining 锛堟暟鎹寲鎺橈級褰撲腑銆?/p>

鈥?Machine 锛堟満锛夆€?鏄粈涔堬紵

Classification Machine锛屾槸鍒嗙被鍣紝杩欎釜娌′粈涔堝ソ璇寸殑銆備篃鍙互鐞嗚В涓虹畻娉曪紝鏈哄櫒瀛︿範棰嗗煙閲岄潰甯稿父鐢?鈥滄満鈥?涔熷氨鏄?machine 杩欎釜瀛楄〃绀虹畻娉曘€?/p>

鈥滄敮鎸佸悜閲忊€?鍙堟槸浠€涔堬紵

閫氫織鐞嗚В锛?support vector 锛堟敮鎸佸悜閲忥級鐨勬剰鎬濆氨鏄?nbsp;鏁版嵁闆嗕腑鐨勬煇浜涚偣锛屼綅缃瘮杈冪壒娈娿€傛瘮濡?x+y-2=0 杩欐潯鐩寸嚎锛岀洿绾夸笂闈㈠尯鍩?x+y-2>0 鐨勫叏鏄?A 绫伙紝涓嬮潰鐨?x+y-2<0 鐨勫叏鏄?B 绫伙紝鎴戜滑鎵捐繖鏉$洿绾跨殑鏃跺€欙紝涓€鑸氨鐪嬭仛闆嗗湪涓€璧风殑涓ょ被鏁版嵁锛屼粬浠悇鑷殑 鏈€杈圭紭 浣嶇疆鐨勭偣锛屼篃灏辨槸鏈€闈犺繎鍒掑垎鐩寸嚎鐨勯偅鍑犱釜鐐癸紝鑰屽叾浠栫偣瀵硅繖鏉$洿绾跨殑鏈€缁堜綅缃殑纭畾璧蜂笉浜嗕綔鐢紝鎵€浠ユ垜濮戜笖鍙繖浜涚偣鍙?鈥滄敮鎸佺偣鈥濓紙鎰忔€濆氨鏄湁鐢ㄧ殑鐐癸級锛屼絾鏄湪鏁板涓婏紝娌¤繖绉嶈娉曪紝鏁板閲岀殑鐐癸紝鍙堝彲浠ュ彨鍚戦噺锛屾瘮濡?浜岀淮鐐?(x,y) 灏辨槸浜岀淮鍚戦噺锛屼笁缁村害鐨勫氨鏄笁缁村悜閲?(x,y,z)銆傛墍浠?鈥?span class="mq-19">鏀寔鐐?/span>鈥?鏀瑰彨 鈥?span class="mq-20">鏀寔鍚戦噺鈥?锛屽惉璧锋潵姣旇緝涓撲笟锛岃€屼笖鍙堣閫硷紝浣曚箰鑰屼笉涓哄憿锛熸槸鍚?..

涓嶉€氫織鐨勭悊瑙?/span>锛?鍦?maximum margin 锛堟渶澶ч棿闅旓級涓婄殑杩欎簺鐐瑰氨鍙?鈥滄敮鎸佸悜閲忊€濓紝鎴戞兂琛ュ厖鐨勬槸涓哄暐杩欎簺鐐瑰氨鍙?鈥滄敮鎸佸悜閲忊€?锛屽洜涓烘渶鍚庣殑 classification machine 锛堝垎绫诲櫒锛夌殑琛ㄨ揪寮忛噷鍙惈鏈夎繖浜?鈥滄敮鎸佸悜閲忊€?鐨勪俊鎭紝鑰屼笌鍏朵粬鏁版嵁鐐规棤鍏筹細


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満


linearly separable 锛堢嚎鎬у彲鍒嗭級: 濡備笂鍥句腑鐨勪袱缁勬暟鎹紝瀹冧滑涔嬮棿宸茬粡鍒嗙殑瓒冲寮€浜嗭紝鍥犳寰堝鏄撳氨鍙互鍦ㄥ浘涓敾鍑轰竴鏉$洿绾垮皢涓ょ粍鏁版嵁鐐瑰垎寮€銆傚湪杩欑鎯呭喌涓嬶紝杩欑粍鏁版嵁灏辫绉颁负绾挎€у彲鍒嗘暟鎹?/strong>銆?/p>


separating hyperplane锛堝垎闅旇秴骞抽潰锛?/code>: 涓婅堪灏嗘暟鎹泦鍒嗛殧寮€鏉ョ殑鐩寸嚎绉颁负鍒嗛殧瓒呭钩闈?/strong>銆?/p>


hyperplane锛堣秴骞抽潰锛?/code>: 鍦ㄤ笂闈㈢粰鍑虹殑渚嬪瓙涓紝鐢变簬鏁版嵁鐐归兘鍦ㄤ簩缁村钩闈笂锛屾墍浠ユ鏃跺垎闅旇秴骞抽潰灏卞彧鏄竴鏉$洿绾裤€備絾鏄紝濡傛灉鎵€缁欑殑鏁版嵁闆嗘槸涓夌淮鐨勶紝閭d箞姝ゆ椂鐢ㄦ潵鍒嗛殧鏁版嵁鐨勫氨鏄竴涓钩闈€傛樉鑰屾槗瑙侊紝鏇撮珮绾害鐨勬儏鍐靛彲浠ヤ緷姝ょ被鎺ㄣ€傚鏋滄暟鎹槸 1024 缁寸殑锛岄偅涔堝氨闇€瑕佷竴涓?1023 缁寸殑鏌愭煇瀵硅薄锛堜笉鏄綘浠殑鐢凤紙濂筹級绁級鏉ュ鏁版嵁杩涜鍒嗛殧銆傝繖涓?1023 缁寸殑鏌愭煇瀵硅薄鍒板簳搴旇鍙粈涔堝憿锛?N-1 缁村憿锛熻瀵硅薄琚О涓?span>瓒呭钩闈?/strong>锛屼篃灏辨槸鍒嗙被鐨勫喅绛栬竟鐣屻€傚垎甯冨湪瓒呭钩闈竴渚х殑鎵€鏈夋暟鎹兘灞炰簬鏌愪釜绫诲埆锛岃€屽垎甯冨湪鍙︿竴渚х殑鎵€鏈夋暟鎹垯灞炰簬鍙︿竴涓被鍒€?/p>

margin锛堥棿闅旓級: 鎴戜滑甯屾湜鑳介€氳繃涓婅堪鐨勬柟寮忔潵鏋勫缓鍒嗙被鍣紝鍗冲鏋滄暟鎹偣绂诲喅绛栬竟鐣岃秺杩滐紝閭d箞鍏舵渶鍚庣殑棰勬祴缁撴灉涔熷氨瓒婂彲淇°€傛棦鐒惰繖鏍凤紝鎴戜滑甯屾湜鎵惧埌绂诲垎闅旇秴骞抽潰鏈€杩戠殑鐐癸紝纭繚瀹冧滑绂诲垎闅旈潰鐨勮窛绂诲敖鍙兘杩溿€傝繖閲屾墍璇寸殑鐐瑰埌鍒嗛殧闈㈢殑璺濈灏辨槸 闂撮殧銆傛垜浠笇鏈涢棿闅斿敖鍙兘鍦板ぇ锛岃繖鏄洜涓哄鏋滄垜浠姱閿欐垨鑰呭湪鏈夐檺鏁版嵁涓婅缁冨垎绫诲櫒鐨勮瘽锛屾垜浠笇鏈涘垎绫诲櫒灏藉彲鑳藉仴澹€?/p>


鏀寔鍚戦噺锛坰upport vector锛?/code> : 灏辨槸涓婇潰鎵€璇寸殑绂诲垎闅旇秴骞抽潰鏈€杩戠殑閭d簺鐐广€?/p>

鍒嗙被鍣?/code> : 鍒嗙被鍣ㄥ氨鏄粰瀹氫竴涓牱鏈殑鏁版嵁锛屽垽瀹氳繖涓牱鏈睘浜庡摢涓被鍒殑绠楁硶銆備緥濡傚湪鑲$エ娑ㄨ穼棰勬祴涓紝鎴戜滑璁や负鍓嶄竴澶╃殑浜ゆ槗閲忓拰鏀剁洏浠峰浜庣浜屽ぉ鐨勬定璺屾槸鏈夊奖鍝嶇殑锛岄偅涔堝垎绫诲櫒灏辨槸閫氳繃鏍锋湰鐨勪氦鏄撻噺鍜屾敹鐩樹环棰勬祴绗簩澶╃殑娑ㄨ穼鎯呭喌鐨勭畻娉曘€?/p>


鐗瑰緛 : 鍦ㄥ垎绫婚棶棰樹腑锛岃緭鍏ュ埌鍒嗙被鍣ㄤ腑鐨勬暟鎹彨鍋氱壒寰併€備互涓婇潰鐨勮偂绁ㄦ定璺岄娴嬮棶棰樹负渚嬶紝鐗瑰緛灏辨槸鍓嶄竴澶╃殑浜ゆ槗閲忓拰鏀剁洏浠枫€?/p>


绾挎€у垎绫诲櫒 : 绾挎€у垎绫诲櫒鏄垎绫诲櫒涓殑涓€绉嶏紝灏辨槸鍒ゅ畾鍒嗙被缁撴灉鐨勬牴鎹槸閫氳繃鐗瑰緛鐨勭嚎鎬х粍鍚堝緱鍒扮殑锛屼笉鑳介€氳繃鐗瑰緛鐨勯潪绾挎€ц繍绠楃粨鏋滀綔涓哄垽瀹氭牴鎹€傝繕浠ヤ笂闈㈢殑鑲$エ娑ㄨ穼棰勬祴闂涓轰緥锛屽垽鏂殑渚濇嵁鍙兘鏄墠涓€澶╃殑浜ゆ槗閲忓拰鏀剁洏浠风殑绾挎€х粍鍚堬紝涓嶈兘灏嗕氦鏄撻噺鍜屾敹鐩樹环杩涜寮€鏂癸紝骞虫柟绛夎繍绠椼€?/p>


How does it work? 锛圫VM 鍘熺悊锛?/span>


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満

https://www.youtube.com/watch?v=3liCbRZPrZA



2銆佹垜璁や负鏄秴绾ч€氫織鐨勪竴涓増鏈細


鏀寔鍚戦噺鏈烘槸鐢ㄦ潵瑙e喅鍒嗙被闂鐨勩€?/p>

鍏堣€冭檻鏈€绠€鍗曠殑鎯呭喌锛岃睂璞嗗拰绫崇矑锛岀敤鏅掑瓙寰堝揩鍙互鍒嗗紑锛屽皬棰楃矑婕忎笅鍘伙紝澶ч绮掍繚鐣欍€?/p>


鐢ㄤ竴涓嚱鏁版潵琛ㄧず灏辨槸褰撶洿寰?d 澶т簬鏌愪釜鍊?D 锛屽氨鍒ゅ畾涓鸿睂璞嗭紝灏忎簬鏌愪釜鍊煎氨鏄背绮掋€?/p>

d>D, 璞岃眴

d<D,绫崇矑


鍦ㄦ暟杞翠笂灏辨槸鍦╠宸﹁竟灏辨槸绫崇矑锛屽彸杈瑰氨鏄豢璞嗭紝杩欐槸涓€缁寸殑鎯呭喌銆?/p>

浣嗘槸瀹為檯闂娌¤繖涔堢畝鍗曪紝鑰冭檻鐨勯棶棰樹笉鍗曞崟鏄昂瀵革紝涓€涓姳鐨勪袱涓搧绉嶏紝鎬庝箞鍒嗙被锛?/p>



鍋囪鍐冲畾浠栦滑鍒嗙被鐨勬湁涓や釜灞炴€э紝鑺辩摚灏哄鍜岄鑹层€傚崟鐙敤涓€涓睘鎬ф潵鍒嗙被锛屽儚鍒氭墠鍒嗙背绮掗偅鏍凤紝灏变笉琛屼簡銆傝繖涓椂鍊欐垜浠缃袱涓€?灏哄 x 鍜岄鑹?y.

鎴戜滑鎶婃墍鏈夌殑鏁版嵁閮戒涪鍒?x-y 骞抽潰涓婁綔涓虹偣锛屾寜閬撶悊濡傛灉鍙湁杩欎袱涓睘鎬у喅瀹氫簡涓や釜鍝佺锛屾暟鎹偗瀹氫細鎸変袱绫昏仛闆嗗湪杩欎釜浜岀淮骞抽潰涓娿€?/p>


鎴戜滑鍙鎵惧埌涓€鏉$洿绾匡紝鎶婅繖涓ょ被鍒掑垎寮€鏉ワ紝鍒嗙被灏卞緢瀹规槗浜嗭紝浠ュ悗閬囧埌涓€涓暟鎹紝灏变涪杩涜繖涓钩闈紝鐪嬪湪鐩寸嚎鐨勫摢涓€杈癸紝灏辨槸鍝竴绫汇€?/p>


姣斿 x+y-2=0 杩欐潯鐩寸嚎锛屾垜浠妸鏁版嵁 (x,y) 浠e叆锛屽彧瑕佽涓?x+y-2>0 鐨勫氨鏄?A 绫伙紝 x+y-2<0 鐨勫氨鏄?B 绫汇€?/p>


浠ユ绫绘帹锛岃繕鏈変笁缁寸殑锛屽洓缁寸殑锛孨缁寸殑 灞炴€х殑鍒嗙被锛岃繖鏍锋瀯閫犵殑涔熻灏变笉鏄洿绾匡紝鑰屾槸骞抽潰锛岃秴骞抽潰銆?/p>

涓€涓笁缁寸殑鍑芥暟鍒嗙被 锛歺+y+z-2=0锛岃繖灏辨槸涓垎绫荤殑骞抽潰浜嗐€?/p>

鏈夋椂鍊欙紝鍒嗙被鐨勯偅鏉$嚎涓嶄竴瀹氭槸鐩寸嚎锛岃繕鏈夊彲鑳芥槸鏇茬嚎锛屾垜浠€氳繃鏌愪簺鍑芥暟鏉ヨ浆鎹紝灏卞彲浠ヨ浆鍖栨垚鍒氭墠鐨勫摢绉嶅缁寸殑鍒嗙被闂锛岃繖涓氨鏄牳鍑芥暟鐨勬€濇兂銆?/p>

渚嬪锛氬垎绫荤殑鍑芥暟鏄釜鍦嗗舰 x^2+y^2-4=0 銆傝繖涓椂鍊欎护 x^2=a ; y^2=b ,杩樹笉灏卞彉鎴愪簡a+b-4=0 杩欑鐩寸嚎闂浜嗐€?/p>


杩欏氨鏄敮鎸佸悜閲忔満鐨勬€濇兂銆?/p>


3銆侊紙杩欎釜闇€瑕佷竴浜涙暟瀛︾煡璇嗭級锛?/strong>

濡傚浘鐨勪緥瀛愶紝锛堣缁冮泦锛夌孩鑹茬偣鏄垜浠凡鐭ョ殑鍒嗙被1锛岋紙璁粌闆嗭級钃濊壊鐐规槸宸茬煡鐨勫垎绫?锛屾垜浠兂瀵绘壘涓€涓垎闅旇秴骞抽潰锛堝浘涓豢绾匡級锛堝洜涓虹ず渚嬫槸浜岀淮鏁版嵁鐐癸紝鎵€浠ュ彧鏄竴鏉$嚎锛屽鏋滄暟鎹槸涓夌淮鐨勫氨鏄钩闈紝濡傛灉鏄笁缁翠互涓婂氨鏄秴骞抽潰锛夋妸杩欎袱绫诲畬鍏ㄥ垎寮€锛岃繖鏍风殑璇濆啀鏉ヤ竴涓牱鏈偣闇€瑕佹垜浠娴嬬殑璇濓紝鎴戜滑灏卞彲浠ユ牴鎹繖涓垎鐣岃秴骞抽潰棰勬祴鍑哄垎绫荤粨鏋溿€?/p>


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満


4銆侊紙杩欎釜闇€瑕佺殑鏁板鐭ヨ瘑鏇村姞鍘夊涓€鐐癸級锛?/strong>


鍏堢湅鎬濈淮瀵煎浘锛?/p>

  • 宸﹁竟鏄眰瑙e熀鏈殑SVM闂

  • 鍙宠竟鏄浉鍏虫墿灞?/p>


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満


浠€涔堟槸 SVM 锛?/strong>

Support Vector Machine, 涓€涓櫘閫氱殑 SVM 灏辨槸涓€鏉$洿绾跨舰浜嗭紝鐢ㄦ潵瀹岀編鍒掑垎 linearly separable 鐨勪袱绫汇€備絾杩欏張涓嶆槸涓€鏉℃櫘閫氱殑鐩寸嚎锛岃繖鏄棤鏁版潯鍙互鍒嗙被鐨勭洿绾垮綋涓渶瀹岀編鐨勶紝鍥犱负瀹冩伆濂藉湪涓や釜绫荤殑涓棿锛岃窛绂讳袱涓被鐨勭偣閮戒竴鏍疯繙銆傝€屾墍璋撶殑 Support vector 灏辨槸杩欎簺绂诲垎鐣岀嚎鏈€杩戠殑銆庣偣銆忋€傚鏋滃幓鎺夎繖浜涚偣锛岀洿绾垮鍗婃槸瑕佹敼鍙樹綅缃殑銆傚彲浠ヨ鏄繖浜?vectors 锛堜富锛岀偣鐐癸級 support 锛堣皳锛屽畾涔夛級浜?machine 锛堝锛屽垎绫诲櫒锛?..


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満


鎵€浠ヨ皽搴曞氨鍦ㄨ皽闈笂鍟婃湅鍙嬩滑锛屽彧瑕佹壘鍒颁簡杩欎簺鏈€闈犺繎鐨勭偣涓嶅氨鎵惧埌浜?SVM 浜嗗槢銆?/p>


濡傛灉鏄珮缁寸殑鐐癸紝SVM 鐨勫垎鐣岀嚎灏辨槸骞抽潰鎴栬€呰秴骞抽潰銆傚叾瀹炴病鏈夊樊锛岄兘鏄竴鍒€鍒囦袱鍧楋紝鎴戝氨缁熺粺鍙洿绾夸簡銆?/p>


鎬庝箞姹傝В SVM 锛?/strong>

鍏充簬杩欐潯鐩寸嚎锛屾垜浠煡閬?/p>

(1)瀹冪涓よ竟涓€鏍疯繙锛?2)鏈€杩戣窛绂诲氨鏄埌support vector鐨勮窛绂伙紝鍏朵粬璺濈鍙兘鏇磋繙銆?/p>

浜庢槸鑷劧鑰岀劧鍙互寰楀埌閲嶈琛ㄨ揪 I. direct representation


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満

甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満




SMO 楂樻晥浼樺寲绠楁硶

  • SVM鏈夊緢澶氱瀹炵幇锛屾渶娴佽鐨勪竴绉嶅疄鐜版槸锛?搴忓垪鏈€灏忎紭鍖?Sequential Minimal Optimization, SMO)绠楁硶銆?/p>

  • 涓嬮潰杩樹細浠嬬粛涓€绉嶇О涓?鏍稿嚱鏁?kernel) 鐨勬柟寮忓皢SVM鎵╁睍鍒版洿澶氭暟鎹泦涓娿€?/p>

  • 娉ㄦ剰锛?code>SVM鍑犱綍鍚箟姣旇緝鐩磋锛屼絾鍏剁畻娉曞疄鐜拌緝澶嶆潅锛岀壍鎵ぇ閲忔暟瀛﹀叕寮忕殑鎺ㄥ銆?/code>


搴忓垪鏈€灏忎紭鍖?Sequential Minimal Optimization, SMO)

  • 鍒涘缓鏃堕棿锛?996骞?/p>

  • SMO鐢ㄩ€旓細鐢ㄤ簬璁粌 SVM

  • SMO鐩爣锛氭眰鍑轰竴绯诲垪 alpha 鍜?b,涓€鏃︽眰鍑?alpha锛屽氨寰堝鏄撹绠楀嚭鏉冮噸鍚戦噺 w 骞跺緱鍒板垎闅旇秴骞抽潰銆?/p>

  • SMO鎬濇兂锛氭槸灏嗗ぇ浼樺寲闂鍒嗚В涓哄涓皬浼樺寲闂鏉ユ眰瑙g殑銆?/p>

  • SMO鍘熺悊锛氭瘡娆″惊鐜€夋嫨涓や釜 alpha 杩涜浼樺寲澶勭悊锛屼竴鏃︽壘鍑轰竴瀵瑰悎閫傜殑 alpha锛岄偅涔堝氨澧炲ぇ涓€涓悓鏃跺噺灏戜竴涓€?/p>

    • 杩欓噷鎸囩殑鍚堥€傚繀椤昏绗﹀悎涓€瀹氱殑鏉′欢

    • 涔嬫墍浠ヨ鍚屾椂鏀瑰彉2涓?alpha锛涘師鍥犳槸鎴戜滑鏈変竴涓害鏉熸潯浠讹細 \(\sum_{i=1}^{m} a_i路label_i=0\)锛涘鏋滃彧鏄慨鏀逛竴涓?alpha锛屽緢鍙兘瀵艰嚧绾︽潫鏉′欢澶辨晥銆?/p>


    1. 杩欎袱涓?alpha 蹇呴』瑕佸湪闂撮殧杈圭晫涔嬪

    2. 杩欎袱涓?alpha 杩樻病鏈夎繘琛岃繃鍖洪棿鍖栧鐞嗘垨鑰呬笉鍦ㄨ竟鐣屼笂銆?/p>


SMO 浼唬鐮佸ぇ鑷村涓嬶細

鍒涘缓涓€涓?alpha 鍚戦噺骞跺皢鍏跺垵濮嬪寲涓?鍚戦噺
褰撹凯浠f鏁板皬浜庢渶澶ц凯浠f鏁版椂(澶栧惊鐜?
    瀵规暟鎹泦涓殑姣忎釜鏁版嵁鍚戦噺(鍐呭惊鐜?锛?        濡傛灉璇ユ暟鎹悜閲忓彲浠ヨ浼樺寲
            闅忔満閫夋嫨鍙﹀涓€涓暟鎹悜閲?            鍚屾椂浼樺寲杩欎袱涓悜閲?            濡傛灉涓や釜鍚戦噺閮戒笉鑳借浼樺寲锛岄€€鍑哄唴寰幆
    濡傛灉鎵€鏈夊悜閲忛兘娌¤浼樺寲锛屽鍔犺凯浠f暟鐩紝缁х画涓嬩竴娆″惊鐜?/code>


SVM 寮€鍙戞祦绋?/h3>
鏀堕泦鏁版嵁锛氬彲浠ヤ娇鐢ㄤ换鎰忔柟娉曘€?鍑嗗鏁版嵁锛氶渶瑕佹暟鍊煎瀷鏁版嵁銆?鍒嗘瀽鏁版嵁锛氭湁鍔╀簬鍙鍖栧垎闅旇秴骞抽潰銆?璁粌绠楁硶锛歋VM鐨勫ぇ閮ㄥ垎鏃堕棿閮芥簮鑷缁冿紝璇ヨ繃绋嬩富瑕佸疄鐜颁袱涓弬鏁扮殑璋冧紭銆?娴嬭瘯绠楁硶锛氬崄鍒嗙畝鍗曠殑璁$畻杩囩▼灏卞彲浠ュ疄鐜般€?浣跨敤绠楁硶锛氬嚑涔庢墍鏈夊垎绫婚棶棰橀兘鍙互浣跨敤SVM锛屽€煎緱涓€鎻愮殑鏄紝SVM鏈韩鏄竴涓簩绫诲垎绫诲櫒锛?br>瀵瑰绫婚棶棰樺簲鐢⊿VM闇€瑕佸浠g爜鍋氫竴浜涗慨鏀广€?/code>



SVM 绠楁硶鐗圭偣

浼樼偣锛氭硾鍖栵紙鐢卞叿浣撶殑銆佷釜鍒殑鎵╁ぇ涓轰竴鑸殑锛屽氨鏄锛氭ā鍨嬭缁冨畬鍚庣殑鏂版牱鏈級閿欒鐜囦綆锛?br>璁$畻寮€閿€涓嶅ぇ锛岀粨鏋滄槗鐞嗚В銆?缂虹偣锛氬鍙傛暟璋冭妭鍜屾牳鍑芥暟鐨勯€夋嫨鏁忔劅锛屽師濮嬪垎绫诲櫒涓嶅姞淇敼浠呴€傚悎浜庡鐞嗕簩鍒嗙被闂銆?浣跨敤鏁版嵁绫诲瀷锛氭暟鍊煎瀷鍜屾爣绉板瀷鏁版嵁銆?/code>



璇炬湰妗堜緥锛堟棤鏍稿嚱鏁帮級


瀵瑰皬瑙勬ā鏁版嵁鐐硅繘琛屽垎绫?/strong>


寮€鍙戞祦绋?/span>




https://github.com/apachecn/AiLearning/blob/master/src/py2.x/ml/6.SVM/svm-complete_Non-Kernel.py




鏀堕泦鏁版嵁

鏂囨湰鏂囦欢鏍煎紡锛?/p>


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満


鏍稿嚱鏁?kernel) 浣跨敤


  • 瀵逛簬绾挎€у彲鍒嗙殑鎯呭喌锛屾晥鏋滄槑鏄?/p>

  • 瀵逛簬闈炵嚎鎬х殑鎯呭喌涔熶竴鏍凤紝姝ゆ椂闇€瑕佺敤鍒颁竴绉嶅彨鏍稿嚱鏁?kernel)鐨勫伐鍏峰皢鏁版嵁杞寲涓哄垎绫诲櫒鏄撲簬鐞嗚В鐨勫舰寮忋€?/p>


鍒╃敤鏍稿嚱鏁板皢鏁版嵁鏄犲皠鍒伴珮缁寸┖闂?/p>

  • 浣跨敤鏍稿嚱鏁帮細鍙互灏嗘暟鎹粠鏌愪釜鐗瑰緛绌洪棿鍒板彟涓€涓壒寰佺┖闂寸殑鏄犲皠銆傦紙閫氬父鎯呭喌涓嬶細杩欑鏄犲皠浼氬皢浣庣淮鐗瑰緛绌洪棿鏄犲皠鍒伴珮缁寸┖闂淬€傦級

  • 濡傛灉瑙夊緱鐗瑰緛绌洪棿寰堣閫笺€佸緢闅剧悊瑙c€?/p>

  • 鍙互鎶婃牳鍑芥暟鎯宠薄鎴愪竴涓寘瑁呭櫒(wrapper)鎴栬€呮槸鎺ュ彛(interface)锛屽畠鑳藉皢鏁版嵁浠庢煇涓緢闅惧鐞嗙殑褰㈠紡杞崲鎴愪负鍙︿竴涓緝瀹规槗澶勭悊鐨勫舰寮忋€?/p>

  • 缁忚繃绌洪棿杞崲鍚庯細浣庣淮闇€瑕佽В鍐崇殑闈炵嚎鎬ч棶棰橈紝灏卞彉鎴愪簡楂樼淮闇€瑕佽В鍐崇殑绾挎€ч棶棰樸€?/p>

  • SVM 浼樺寲鐗瑰埆濂界殑鍦版柟锛屽湪浜庢墍鏈夌殑杩愮畻閮藉彲浠ュ啓鎴愬唴绉?inner product: 鏄寚2涓悜閲忕浉涔橈紝寰楀埌鍗曚釜鏍囬噺 鎴栬€?鏁板€?锛涘唴绉浛鎹㈡垚鏍稿嚱鏁扮殑鏂瑰紡琚О涓?code>鏍告妧宸?kernel trick)鎴栬€?code>鏍?鍙樼數"(kernel substation)

  • 鏍稿嚱鏁板苟涓嶄粎浠呭簲鐢ㄤ簬鏀寔鍚戦噺鏈猴紝寰堝鍏朵粬鐨勬満鍣ㄥ涔犵畻娉曚篃閮界敤鍒版牳鍑芥暟銆傛渶娴佽鐨勬牳鍑芥暟锛氬緞鍚戝熀鍑芥暟(radial basis function)

  • 寰勫悜鍩哄嚱鏁扮殑楂樻柉鐗堟湰锛屽叾鍏蜂綋鐨勫叕寮忎负锛?/p>


甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満

椤圭洰妗堜緥: 鎵嬪啓鏁板瓧璇嗗埆鐨勪紭鍖栵紙鏈夋牳鍑芥暟锛?/strong>


椤圭洰姒傝堪

浣犵殑鑰佹澘瑕佹眰锛氫綘鍐欑殑閭d釜鎵嬪啓璇嗗埆绋嬪簭闈炲父濂斤紝浣嗘槸瀹冨崰鐢ㄥ唴瀛樺お澶с€傞【瀹㈡棤娉曢€氳繃鏃犵嚎鐨?br>鏂瑰紡涓嬭浇鎴戜滑鐨勫簲鐢ㄣ€?鎵€浠ワ細鎴戜滑鍙互鑰冭檻浣跨敤鏀寔鍚戦噺鏈猴紝淇濈暀鏀寔鍚戦噺灏辫锛坘nn闇€瑕佷繚鐣欐墍鏈夌殑鍚戦噺锛夛紝
灏卞彲浠ヨ幏寰楅潪甯稿ソ鐨勬晥鏋溿€?/pre>


浣跨敤绠楁硶锛氫竴涓浘鍍忚瘑鍒殑瀹屾暣搴旂敤杩橀渶瑕佷竴浜涘浘鍍忓鐞嗙殑鐭ヨ瘑



寮€鍙戞祦绋?br>

鏀堕泦鏁版嵁锛氭彁渚涚殑鏂囨湰鏂囦欢


https://github.com/apachecn/AiLearning/blob/dev/blog/ml/6.1.%E6%94%AF%E6%8C%81%E5%90%91%E9%87%8F%E6%9C%BA%E7%9A%84%E5%87%A0%E4%B8%AA%E9%80%9A%E4%BF%97%E7%90%86%E8%A7%A3.md


https://github.com/apachecn/AiLearning/blob/dev/blog/ml/6.%E6%94%AF%E6%8C%81%E5%90%91%E9%87%8F%E6%9C%BA.md



闃呰杩囨湰鏂囩殑浜鸿繕鐪嬩簡浠ヤ笅锛?/strong>























涓嶆柇鏇存柊璧勬簮

娣卞害瀛︿範銆佹満鍣ㄥ涔犮€佹暟鎹垎鏋愩€乸ython


以上是关于甯歌闈㈣瘯绠楁硶锛氭敮鎸佸悜閲忔満的主要内容,如果未能解决你的问题,请参考以下文章

甯歌闈㈣瘯绠楁硶锛氭湸绱犺礉鍙舵柉

鏈哄櫒瀛︿範瀹炴垬锛?锛夛細鏀寔鍚戦噺鏈猴紙涓嬶級

瀛楄妭璺冲姩鏈€甯歌€冪殑 64 閬揓S绠楁硶棰?/a>

銆愬崄澶╄嚜鍒惰蒋娓叉煋鍣ㄣ€慏AY 02锛氱敾涓€鏉$洿绾匡紙DDA 绠楁硶 & Bresenham鈥檚 绠楁硶锛?/a>

銆愬崄澶╄嚜鍒惰蒋娓叉煋鍣ㄣ€慏AY 03锛氱敾涓€涓笁瑙掑舰锛堝悜閲忓弶涔樼畻娉?& 閲嶅績鍧愭爣绠楁硶锛?/a>

闈㈣瘯涓殑缃戠孩铏氭嫙DOM锛屼綘鐭ュ灏戝憿锛熸繁鍏ヨВ璇籨iff绠楁硶