Rで学ぶTree-Based ModelsによるMachine Learning
Sandro Raabe
Data Scientist
ranger, randomForesttidymodels のインターフェース: rand_forest()(parsnip パッケージ)
rand_forest()【ハイパーパラメータ】
mtry: 各ノードで見る予測子数、既定:trees: フォレスト内の木の数 min_n: 許可される最小ノードサイズrand_forest(mtry = 4,trees = 500,min_n = 10) %>%# Set the mode set_mode("classification") %>%# Use engine ranger or randomForest set_engine("ranger")
spec <- rand_forest(trees = 100) %>%set_mode("classification") %>%set_engine("ranger")
ランダムフォレストのモデル仕様(classification)主な引数: trees = 100計算エンジン: ranger
spec %>% fit(still_customer ~ ., data = customers_train)
parsnip モデルオブジェクト
学習時間: 631ms
Ranger の結果
ツリー数: 100
サンプルサイズ: 9116
独立変数の数: 19
Mtry: 4
ターゲットノードサイズ: 10
rand_forest(mode = "classification") %>% set_engine("ranger", importance = "impurity") %>%fit(still_customer ~ ., data = customers_train) %>%vip::vip()

Rで学ぶTree-Based ModelsによるMachine Learning