美文网首页
Quickstart of mlr3 package

Quickstart of mlr3 package

作者: 灵活胖子的进步之路 | 来源:发表于2022-08-13 21:33 被阅读0次

As a 30-second introductory example, we will train a decision tree model on the first 120 rows of iris data set and make predictions on the final 30, measuring the accuracy of the trained model.

library("mlr3")
task = tsk("iris")
learner = lrn("classif.rpart")

# train a model of this learner for a subset of the task
learner$train(task, row_ids = 1:120)
# this is what the decision tree looks like
learner$model
训练模型结果
predictions = learner$predict(task, row_ids = 121:150)
predictions
模型测试结果
predictions$score(msr("classif.acc"))
predictions$confusion
predictions$truth
测试结果参数

相关文章

网友评论

      本文标题:Quickstart of mlr3 package

      本文链接:https://www.haomeiwen.com/subject/dbxcgrtx.html