iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 21
1
影片教學

R語言-預測方法大全系列 第 21

[Day-21] 預測操作--xgb-下 (xgb predict in r)

您的訂閱是我製作影片的動力
訂閱點這裡~/images/emoticon/emoticon39.gif

Yes

若內容有誤,還請留言指正,謝謝您的指教/images/emoticon/emoticon07.gif

#影片程式碼
#延續DAY20
set.seed(123)
model <-  xgboost(data = trainx[,-c(4:6)],
                  label = trainy,
                  nrounds = 105,eta=0.05,
                  min_child_weight=3,max_depth=7,
                  subsample=0.8,colsample_bytree=1,
                  objective = "reg:squarederror",verbose = 0) 

future <- predict(model,testx[,-c(4:6)])
future <- as.data.frame(future)
final <- cbind(future,testy,testx[,-c(4:6)])
final <- mutate(final,mape=abs(future-testy)/testy)
mean(final$mape)

上一篇
[Day-20] 預測操作--xgb-中 (xgb tuning in r)
下一篇
[Day-22] 預測操作--SVM-上 (SVM predict in r)
系列文
R語言-預測方法大全30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言