- Notifications
You must be signed in to change notification settings - Fork26
Dataflow Programming for Machine Learning in R
License
mlr-org/mlr3pipelines
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Dataflow Programming for Machine Learning in R.
Watch our “WhyR 2020” Webinar Presentation on Youtube for anintroduction! Find the slideshere.
mlr3pipelines
is adataflowprogramming toolkitfor machine learning in R utilising themlr3 package. Machine learningworkflows can be written as directed “Graphs” that represent data flowsbetween preprocessing, model fitting, and ensemble learning units in anexpressive and intuitive language. Using methods from themlr3tuning package, it iseven possible to simultaneously optimize parameters of multipleprocessing units.
In principle,mlr3pipelines is about defining singular data and modelmanipulation steps as “PipeOps”:
pca= po("pca")filter= po("filter",filter=mlr3filters::flt("variance"),filter.frac=0.5)learner_po= po("learner",learner= lrn("classif.rpart"))
These pipeops can then be combined together to define machine learningpipelines. These can be wrapped in aGraphLearner
that behave like anyotherLearner
inmlr3
.
graph=pca %>>%filter %>>%learner_poglrn=GraphLearner$new(graph)
This learner can be used for resampling, benchmarking, and even tuning.
resample(tsk("iris"),glrn, rsmp("cv"))#> <ResampleResult> with 10 resampling iterations#> task_id learner_id resampling_id iteration warnings errors#> iris pca.variance.classif.rpart cv 1 0 0#> iris pca.variance.classif.rpart cv 2 0 0#> iris pca.variance.classif.rpart cv 3 0 0#> iris pca.variance.classif.rpart cv 4 0 0#> iris pca.variance.classif.rpart cv 5 0 0#> iris pca.variance.classif.rpart cv 6 0 0#> iris pca.variance.classif.rpart cv 7 0 0#> iris pca.variance.classif.rpart cv 8 0 0#> iris pca.variance.classif.rpart cv 9 0 0#> iris pca.variance.classif.rpart cv 10 0 0
Single computational steps can be represented as so-calledPipeOps,which can then be connected with directed edges in aGraph. Thescope ofmlr3pipelines is still growing; currently supported featuresare:
- Simple data manipulation and preprocessing operations, e.g. PCA,feature filtering
- Task subsampling for speed and outcome class imbalance handling
- mlr3Learner operations for prediction and stacking
- Simultaneous path branching (data going both ways)
- Alternative path branching (data going one specific way, controlled byhyperparameters)
- Ensemble methods and aggregation of predictions
A good way to get intomlr3pipelines
are the following two vignettes:
mlr3pipelines is a free and open source software project thatencourages participation and feedback. If you have any issues,questions, suggestions or feedback, please do not hesitate to open an“issue” about it on the GitHub page!
In case of problems / bugs, it is often helpful if you provide a“minimum working example” that showcases the behaviour (but don’t worryabout this if the bug is obvious).
Please understand that the resources of the project are limited:response may sometimes be delayed by a few days, and some featuresuggestions may be rejected if they are deemed too tangential to thevision behind the project.
If you use mlr3pipelines, please cite ourJMLRarticle:
@Article{mlr3pipelines, title = {{mlr3pipelines} - Flexible Machine Learning Pipelines in R}, author = {Martin Binder and Florian Pfisterer and Michel Lang and Lennart Schneider and Lars Kotthoff and Bernd Bischl}, journal = {Journal of Machine Learning Research}, year = {2021}, volume = {22}, number = {184}, pages = {1-7}, url = {https://jmlr.org/papers/v22/21-0281.html},}
A predecessor to this package is themlrCPO-package, which works withmlr 2.x. Other packages that provide, to varying degree, somepreprocessing functionality or machine learning domain specificlanguage, are thecaret package andthe relatedrecipes project, andthedplyr package.
About
Dataflow Programming for Machine Learning in R