實驗報告 支持向量機_第1頁
實驗報告 支持向量機_第2頁
實驗報告 支持向量機_第3頁
實驗報告 支持向量機_第4頁
實驗報告 支持向量機_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

#實驗報告支持向量機實驗原理:支持向量機的原理和實現(xiàn)技術(shù)。。實驗題目:對鳶尾花數(shù)據(jù)利用SVM技術(shù)進行分類預測。實驗要求:把鳶尾花數(shù)據(jù)分成訓練集和測試集,然后針對樣本SVM預測分類實驗題目--分析報告:data(iris)>rm(list=ls())>gc()used(Mb)gctrigger(Mb)maxused(Mb)Ncells25214313.560839432.541051522.0Vcells5284864.1838860864.0160673612.3>library(MASS)>library(MASS)>data(iris)>library(e1071)>summary(iris)Sepal.LengthSepal.WidthMin.:4.300Min.:2.0001stQu.:5.1001stQu.:2.800Median:5.800Median:3.000Mean:5.843Mean:3.0573rdQu.:6.4003rdQu.:3.300Max.:7.900Max.:4.400Petal.LengthPetal.WidthMin.:1.000Min.:0.1001stQu.:1.6001stQu.:0.300Median:4.350Median:1.300Mean:3.758Mean:1.1993rdQu.:5.1003rdQu.:1.800Max.:6.900Max.:2.500Speciessetosa:50versicolor:50virginica:50僅選擇Petal.Length和Petal.Width這兩個特征時>model<-svm(Petal.Length~Petal.Width,data=iris)>print(model)Call:svm(formula=Petal.Length~Petal.Width,data=iris)Parameters:SVM-Type:eps-regressionSVM-Kernel:radialcost:1gamma:1epsilon:0.1NumberofSupportVectors:80>summary(model)Call:svm(formula=Petal.Length~Petal.Width,data=iris)Parameters:SVM-Type:eps-regressionSVM-Kernel:radialcost:1gamma:1epsilon:0.1NumberofSupportVectors:80>svm(formula=Petal.Length~Petal.Width,data=iris)Call:svm(formula=Petal.Length~Petal.Width,data=iris)Parameters:SVM-Type:eps-regressionSVM-Kernel:radialcost:1gamma:1epsilon:0.1NumberofSupportVectors:80>predict(model,iris)12312341.4238371.4238371.4238371.42383791011121.4238371.4569131.4238371.423837171819201.6164691.4770961.4770961.477096252627281.4238371.4238371.6164691.423837333435361.4569131.4238371.4238371.423837414243441.4770961.4770961.4238372.115572495051521.4238371.4238374.4971394.675747575859604.8369863.4771784.2931204.497139656667684.2931204.4971394.6757473.47717856781.4238371.6164691.4770961.423837131415161.4569131.4569131.4238371.616469212223241.4238371.6164691.4238371.834129293031321.4238371.4238371.4238371.616469373839401.4238371.4569131.4238371.423837454647481.6164691.4770961.4238371.423837535455564.6757474.2931204.6757474.293120616263643.4771784.6757473.4771784.497139697071724.6757473.7845145.1343674.29312073747576777879804.6757474.0568294.2931204.4971394.4971394.9881834.6757473.47717881828384858687883.7845143.4771784.0568294.8369864.6757474.8369864.6757474.29312089909192939495964.2931204.2931204.0568294.4971394.0568293.4771784.2931204.0568299798991001011021031044.2931204.2931203.7845144.2931205.7523445.2771775.5403125.1343671051061071081091101111125.6463545.5403124.9881835.1343675.1343675.7523445.4144235.2771771131141151161171181191205.5403125.4144235.7604485.7228085.1343675.6463545.7228084.6757471211221231241251261271285.7228085.4144235.4144235.1343675.5403125.1343675.1343675.1343671291301311321331341351365.5403124.8369865.2771775.4144235.6463544.6757474.4971395.7228081371381391401411421431445.7604485.1343675.1343675.5403125.7604485.7228085.2771775.7228081451461471481491505.7523445.7228085.2771775.4144235.7228085.134367分割數(shù)據(jù)集>set.seed(2)>test=sample(1:nrow(iris),100)>iris.train<-iris[-test,]>iris.test<-iris[test,]>dim(iris.train);dim(iris.test)[1]505[1]1005

>model<-svm(Petal.Length~Petal.Width,data=iris.train)prediction<-predict(model,iris.test[,-1])tab<-table(predtab<-table(pred=prediction,trueris.test[,1])tabtrueed4.34.44.64.84.955.1525.4555.6575.85961.476426185233510122142221001001.514934525019011001200100000001.537794306199520001012000010001.696750649553480000011030000001.940503187907960000001000000002.247766796584170000010000000003.593325051594760000110001010013.857169576777270000001001100004.075688311422150000000001011004.254279229338620000000000220004.404109854107820000000100000004.539639007089480000000010100124.675688856047920000000000000014.824398220950480000100000000004.992496243428280000000000000005.17942227280050000000000002005.376786409977140000000000100005.569454200330490000000000000005.738170283834570000000000000005.863218184264910000000000000005.923719404515560000000000000005.92829837440344000000000000100truepred6.16.26.36.46.56.66.76.86.97.27.37.47.77.91.47642618523351000000000000001.51493452501901000000000000001.53779430619952000000000000001.69675064955348000000000000001.94050318790796000000000000002.24776679658417000000000000003.59332505159476000000000000003.85716957677727000000000000004.07568831142215100000000000004.25427922933862001101000000004.40410985410782300001000000004.53963900708948001100100000004.67568885604792001000000100004.82439822095048000000100000004.99249624342828110110100110005.1794222728005001000000001005.37678640997714000000000000015.56945420033049000000011000005.73817028383457000010000000105.86321818426491010100012000105.92371940451556001000100000005.9282983744034400100010000000>classAgreement(tab)$'diag'[1]0.02$kappa[1]-0.01554404$rand[1]0.910101$crand[1]0.05377635>tuned<-tune.svm(Petal.Length~Petal.Width,data=iris.train,gamma=10八(-6:-1),+cost=10八(1:2))>summary(tuned)Parametertuningof‘svm':samplingmethod:10-foldcrossvalidationbestparameters:gammacost0.110bestperformance:0.1490541-Detailedperformanceresults:gammacosterrordispersion11e-06103.47224882.206454121e-05103.42808442.180270331e-0410

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論