如何在 r-drake 中映射变换
How to map transform in r-drake
请问在r-drake中如何使用函数GraphLearner$new
进行变形。
代码如下:
learner_plan = drake_plan(
## 1. Choose learner--------------------------------------------------------
polrn_classif = target(fnc_po_learner(list_learners),
transform = map(
list_learners = c(
"classif.ranger",
"classif.lightgbm",
"classif.xgboost",
"classif.log_reg",
"classif.svm"
)
)),
graph_classif = target(
imputer_classif %>>% filter_classif %>>% polrn_classif,
transform = map(polrn_classif)
),
glrn_classif = target({
GraphLearner$new(graph = graph_classif) # get error ---------- it's not transform
transform = map(graph_classif)
})
)
learner_plan
transform = map(graph_classif)
应该在大括号之外。
library(drake)
learner_plan = drake_plan(
polrn_classif = target(
fnc_po_learner(list_learners),
transform = map(
list_learners = c(
"classif.ranger",
"classif.lightgbm",
"classif.xgboost",
"classif.log_reg",
"classif.svm"
)
)
),
graph_classif = target(
imputer_classif %>>% filter_classif %>>% polrn_classif,
transform = map(polrn_classif)
),
glrn_classif = target({
GraphLearner$new(graph = graph_classif)
}, transform = map(graph_classif)) # outside the curly braces
)
plot(learner_plan)
由 reprex package (v2.0.0)
于 2021-07-07 创建
请问在r-drake中如何使用函数GraphLearner$new
进行变形。
代码如下:
learner_plan = drake_plan(
## 1. Choose learner--------------------------------------------------------
polrn_classif = target(fnc_po_learner(list_learners),
transform = map(
list_learners = c(
"classif.ranger",
"classif.lightgbm",
"classif.xgboost",
"classif.log_reg",
"classif.svm"
)
)),
graph_classif = target(
imputer_classif %>>% filter_classif %>>% polrn_classif,
transform = map(polrn_classif)
),
glrn_classif = target({
GraphLearner$new(graph = graph_classif) # get error ---------- it's not transform
transform = map(graph_classif)
})
)
learner_plan
transform = map(graph_classif)
应该在大括号之外。
library(drake)
learner_plan = drake_plan(
polrn_classif = target(
fnc_po_learner(list_learners),
transform = map(
list_learners = c(
"classif.ranger",
"classif.lightgbm",
"classif.xgboost",
"classif.log_reg",
"classif.svm"
)
)
),
graph_classif = target(
imputer_classif %>>% filter_classif %>>% polrn_classif,
transform = map(polrn_classif)
),
glrn_classif = target({
GraphLearner$new(graph = graph_classif)
}, transform = map(graph_classif)) # outside the curly braces
)
plot(learner_plan)
由 reprex package (v2.0.0)
于 2021-07-07 创建