[問題] 關於randomforest
[問題類型]:
意見調查(我對R 有個很棒的想法,想問問大家的意見)
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
請把以下不需要的部份刪除
使用者(已經有用R 做過不少作品)
[問題敘述]:
抱歉有一些關於randomforest使用上的問題想要問一下
目前我使用randomForest這個套件去訓練我的樹
然後想要使用https://github.com/araastat/reprtree/tree/master/R
上面那個套件的retree畫出我的樹
但是遇到了一些問題
訓練組跟測試組所畫的樹不一樣
以及如果我現在是想要做隨機森林的特徵選取
那我該如何下手因為用不同的資料所會出的樹不一樣
[程式範例]:
請把以下不需要的部份刪除
library(reprtree)
rforest <- randomForest(type~., data=train_data)
reptree <- ReprTree(rforest, train_data, metric='d2')
plot(reptree, index=1)
reptree <- ReprTree(rforest, test_data, metric='d2')
plot(reptree, index=1)
[環境敘述]:
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=zh_TW.UTF-8 LC_NUMERIC=C
LC_TIME=zh_TW.UTF-8
[4] LC_COLLATE=zh_TW.UTF-8 LC_MONETARY=zh_TW.UTF-8
LC_MESSAGES=zh_TW.UTF-8
[7] LC_PAPER=zh_TW.UTF-8 LC_NAME=C
LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=zh_TW.UTF-8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1
[關鍵字]:
隨機森林、特徵選取、繪圖
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.125.96.131
※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1506524943.A.391.html
推
09/27 23:35,
6年前
, 1F
09/27 23:35, 1F
→
09/27 23:37,
6年前
, 2F
09/27 23:37, 2F
→
09/27 23:51,
6年前
, 3F
09/27 23:51, 3F
→
09/27 23:52,
6年前
, 4F
09/27 23:52, 4F
→
09/27 23:54,
6年前
, 5F
09/27 23:54, 5F
→
09/28 00:00,
6年前
, 6F
09/28 00:00, 6F
→
09/28 00:01,
6年前
, 7F
09/28 00:01, 7F
→
09/28 00:01,
6年前
, 8F
09/28 00:01, 8F
→
09/28 00:02,
6年前
, 9F
09/28 00:02, 9F
→
09/28 00:02,
6年前
, 10F
09/28 00:02, 10F
→
09/28 00:04,
6年前
, 11F
09/28 00:04, 11F
推
09/28 10:03,
6年前
, 12F
09/28 10:03, 12F
→
09/28 10:03,
6年前
, 13F
09/28 10:03, 13F
→
09/28 10:03,
6年前
, 14F
09/28 10:03, 14F
→
09/28 11:56,
6年前
, 15F
09/28 11:56, 15F
推
09/28 14:37,
6年前
, 16F
09/28 14:37, 16F
→
09/28 14:37,
6年前
, 17F
09/28 14:37, 17F
推
09/28 16:45,
6年前
, 18F
09/28 16:45, 18F
→
09/28 16:46,
6年前
, 19F
09/28 16:46, 19F
→
09/28 16:58,
6年前
, 20F
09/28 16:58, 20F