Groups
Groups
Sign in
Groups
Groups
R軟體使用者論壇
Conversations
About
Send feedback
Help
問題:請問e1071的svm的使用情況
483 views
Skip to first unread message
王翎聿
unread,
Jan 17, 2015, 4:16:42 AM
1/17/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to taiwa...@googlegroups.com
各位前輩,不知道有否使用過e1071的svm,
我準備了一份預測股市資料,要使用svm進行預測,
準備了8個輸入值(X),
因為研究變動方向,所以將Y值設為:1為向上變動、2為向下變動的類別變數
也將資料切割為訓練資料跟測試資料,
但在使用svm的時候卻出現錯誤訊息,內容為
「Need numeric dependent variable for regression.」
所以我又將Y值更變為數值變數,
使用svm也沒再出現問題,
但後面出現結果不是我要的,
因為全部都是數值,
而非類別變數,
也就是1或2的情況,
因為這樣才能判斷。
這個狀況困擾小弟許久,
不知道有沒有前輩、朋友能幫小弟解惑一下。
He-chien Tsai
unread,
Jan 18, 2015, 12:33:14 AM
1/18/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to taiwa...@googlegroups.com
不知道e1071是啥
支持向量的方法是有分成回歸跟分類這兩種用途的不同模型,
猜測您是誤用支持向量回歸(SVR)成支持向量機(SVM)了
留意一下您的算法是用來回歸還是分類, 看是不是有漏掉啥說明
也有些函式庫是自動分辨Y值, 若Y值為字串就當成分類, 數值就自動改成回歸
王翎聿於 2015年1月17日星期六 UTC+8下午5時16分42秒寫道:
Wush Wu
unread,
Jan 29, 2015, 3:55:16 AM
1/29/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to taiwa...@googlegroups.com
e1071是Libsvm在R 上的wrapper,
根據文件,他會依據y的形態決定要跑classification或regression
你先把y變成factor(y)或character(y),應該就可以跑classification了。
如果弄成numeric(y),他就如同He-chien Tsai兄所描述的,跑成regression了。
He-chien Tsai於 2015年1月18日星期日 UTC+8下午1時33分14秒寫道:
王翎聿
unread,
Feb 2, 2015, 10:12:31 PM
2/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to taiwa...@googlegroups.com
謝謝前輩們的回應,問題已經解決了,感謝。
Reply all
Reply to author
Forward
0 new messages