Re: [分享] mlr package

看板R_Language作者 (為什麼會流淚)時間9年前 (2016/11/28 15:31), 9年前編輯推噓1(105)
留言6則, 1人參與, 最新討論串2/4 (看更多)
※ 引述《clansoda (小笨)》之銘言: : [關鍵字]:mlr、machine learning : [出處]:https://mlr-org.github.io/mlr-tutorial/release/html/ : [重點摘要]:e1071、randomForest、caret這些知名的package來回調用 : 重要的machine learning function嗎? 相信一定會有覺得很煩,每個 : function怎麼要求的都不同,有的input要matrix有的要全都是數字,都 : 沒有一個整合的平台可以使用嗎? 我這不就來了嗎。 : mlr package是一個整合R上泛用常見的machine learning package的平台 : 可以讓你在一行之內的改變就可以access to大部分的機器學習演算法 : [分享內容]: : ## 首先你要先告訴mlr你現在的training data是誰,還有你想predict的 : ## column name,這篇文章我會以iris來作範例,假如是regression用regr代替 : ## classification則用classif,在iris是classification所以是classif : tsk <- makeClassifTask(data = iris , target = "Species") : ## 這邊有一個argument叫ID,再後來是有其他用途的,但這邊我不設的話 : ## 他預設就是你的dataframe的名稱,Species是我們要預測的colname : ## 接著我們可以開始訓練我們要的model了 : mod <- train("classif.randomForest",task = iris) : ## 這邊是最簡易的做法,使用train function給予他你learner的名稱與 : ## 上面我們賦予的task就能開始訓練,mlr接受直接使用""包含你的learning : ## method,像是最簡單的線性回歸就叫做regr.lm,但是這種寫法你是使用 : ## default的參數,你才可以這樣做,若是你想要改變參數的話 : lrn <- makelearner(...) : ## makelearner function後面還有許多參數可以調整,可以自行參酌manual : ## 最後到了predict的階段 : output <- predict(mod,newdata = iris) : final <- output$data : ## 這樣就可以得到最後的訓練結果了,在makelearner那部分可以修改predict type : ## 將他設成prob就能得到機率結果囉,這邊是最最簡單的使用方法,基本上machine : ## learning裡面不論是feature selection、missing value imputation、還有 : ## parameter tuning等等等功能全部都包含在這一個package裡面,希望能幫助到 : ## 想要使用R作為機器學習平台的使用者。需要更詳細的tutorial請參照來源, : ## 寫的跟rstudio裡面的文章一樣的仔細,一步一步帶你做。 我用install_github("mlr-org/mlr")去下載 出現以下error Downloading GitHub repo mlr-org/mlr@master from URL https://api.github.com/repos/mlr-org/mlr/zipball/master Installing mlr "D:/MRO/R-3.3.0/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Asus/AppData/Local/Temp/RtmpWul6Rh/devtools1ef451721bb/mlr-org-mlr-211d245" --library="D:/MRO/R-3.3.0/library" --install-tests * installing *source* package 'mlr' ... ** libs c:/Rtools/mingw_64/bin/gcc -m64 -I"D:/MRO/R-33~1.0/include" -DNDEBUG -I"c:/applications/extsoft/include" -O2 -Wall -std=gnu99 -mtune=core2 -c smote.c -o smote.o c:/Rtools/mingw_64/bin/gcc -m64 -shared -s -static-libgcc -o mlr.dll tmp.def smote.o -Lc:/applications/extsoft/lib/x64 -Lc:/applications/extsoft/lib -LD:/MRO/R-33~1.0/bin/x64 -lR installing to D:/MRO/R-3.3.0/library/mlr/libs/x64 ** R Warning: unable to re-encode 'plotViperCharts.R' line 33 ** data *** moving datasets to lazyload DB ** inst ** tests ** byte-compile and prepare package for lazy loading Error : package 'ParamHelpers' 1.7 was found, but >= 1.8 is required by 'mlr' ERROR: lazy loading failed for package 'mlr' * removing 'D:/MRO/R-3.3.0/library/mlr' 錯誤: Command failed (1) 有人知道怎解嗎?? 我也試著去這下載 https://cran.r-project.org/web/packages/mlr/index.html 下載 Windows binaries: mlr_2.9.zip 然後解壓縮放到我的library資料夾中 還是error 顯示 package ‘BBmisc’ 1.9 was found, but >= 1.10 is required by ‘mlr’ 此外: Warning message: package ‘mlr’ was built under R version 3.3.2 ps: 我目前是使用Microsoft R Open 3.3.0 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.36.58.108 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1480318294.A.1F3.html

11/28 15:50, , 1F
重裝 paramhelper呢? 看起來是版本太舊
11/28 15:50, 1F

11/28 15:50, , 2F
你的是1.7版 他需要1.8版以上
11/28 15:50, 2F

11/28 15:51, , 3F
你的BBmisc也重裝看看,裝比較新的版本
11/28 15:51, 3F

11/28 15:51, , 4F
我沒用過Microsoft R Open,根據他們官網的解釋
11/28 15:51, 4F

11/28 15:52, , 5F
應該是不會有跟原版在package安裝上有不相同的地方
11/28 15:52, 5F

11/28 15:52, , 6F
錯誤的點應該是你的package太老舊
11/28 15:52, 6F
感謝 已解決 看來真的是我packages太舊的問題 ※ 編輯: f496328mm (114.36.58.108), 11/28/2016 20:46:10
文章代碼(AID): #1OEzrM7p (R_Language)
討論串 (同標題文章)
本文引述了以下文章的的內容:
3
11
以下文章回應了本文
完整討論串 (本文為第 2 之 4 篇):
3
11
文章代碼(AID): #1OEzrM7p (R_Language)