library("mlr3")
graph = po("pca") %>>% lrn("classif.rpart")
lr = GraphLearner$new(graph)
lr = as_learner(graph) # equivalent
lr$train(tsk("iris"))
lr$graph$state # untrained version!
# The following is therefore NULL:
lr$graph$pipeops$classif.rpart$learner_model$model
# To access the trained model from the PipeOpLearner's Learner, use:
lr$graph_model$pipeops$classif.rpart$learner_model$model
# Feature importance (of principal components):
lr$graph_model$pipeops$classif.rpart$learner_model$importance()
Run the code above in your browser using DataLab