| Maintainer: | Torsten Hothorn, Hannah Frick, Lucas Kook |
| Contact: | Torsten.Hothorn at R-project.org |
| Version: | 2025-08-18 |
| URL: | https://CRAN.R-project.org/view=MachineLearning |
| Source: | https://github.com/cran-task-views/MachineLearning/ |
| Contributions: | Suggestions and improvements for this task view are very welcome and can be made through issues or pull requests on GitHub or via e-mail to the maintainer address. For further details see theContributing guide. |
| Citation: | Torsten Hothorn, Hannah Frick, Lucas Kook (2025). CRAN Task View: Machine Learning & Statistical Learning. Version 2025-08-18. URL https://CRAN.R-project.org/view=MachineLearning. |
| Installation: | The packages from this task view can be installed automatically using thectv package. For example,ctv::install.views("MachineLearning", coreOnly = TRUE) installs all the core packages orctv::update.views("MachineLearning") installs all packages that are not yet installed and up-to-date. See theCRAN Task View Initiative for more details. |
Several add-on packages implement ideas and methods developed at the borderline between computer science and statistics - this field of research is usually referred to as machine learning. The packages can be roughly structured into the following topics:
Neural Networks and Deep Learning : Single-hidden-layer neural network are implemented in packagennet (shipped with base R). PackageRSNNS offers an interface to the Stuttgart Neural Network Simulator (SNNS). Packages implementing deep learning flavours of neural networks includedeepnet (feed-forward neural network, restricted Boltzmann machine, deep belief network, stacked autoencoders) andh2o (feed-forward neural network, deep autoencoders). An interface totensorflow is available intensorflow. Thetorch package implements an interface to thelibtorch library. There is alsomlr3torch which integrates torch into themlr3 ecosystem.
Recursive Partitioning : Tree-structured models for regression, classification and survival analysis, following the ideas in the CART book, are implemented inrpart (shipped with base R) andtree. Packagerpart is recommended for computing CART-like trees. A rich toolbox of partitioning algorithms is available inWeka, packageRWeka provides an interface to this implementation, including the J4.8-variant of C4.5 and M5. TheCubist package fits rule-based models (similar to trees) with linear regression models in the terminal leaves, instance-based corrections and boosting. TheC50 package can fit C5.0 classification trees, rule-based models, and boosted versions of these.pre can fit rule-based models for a wider range of response variable types.
Two recursive partitioning algorithms with unbiased variable selection and statistical stopping criterion are implemented in packageparty andpartykit. Functionctree() is based on non-parametric conditional inference procedures for testing independence between response and each input variable whereasmob() can be used to partition parametric models. Extensible tools for visualizing binary trees and node distributions of the response are available in packageparty andpartykit as well. Partitioning of mixed-effects models (GLMMs) can be performed with packageglmertree; partitioning of structural equation models (SEMs) can be performed with packagesemtree.
Graphical tools for the visualization of trees are available in packagemaptree.
Partitioning of mixture models is performed byRPMM.
Computational infrastructure for representing trees and unified methods for prediction and visualization is implemented inpartykit. This infrastructure is used by packageevtree to implement evolutionary learning of globally optimal trees. Survival trees are available in various packages.
Trees for subgroup identification with respect to heterogenuous treatment effects are available in packagespartykit,model4you,dipm,quint,SIDES, andpsica (and probably many more).
Random Forests : The reference implementation of the random forest algorithm for regression and classification is available in packagerandomForest. Packageipred has bagging for regression, classification and survival analysis as well as bundling, a combination of multiple models via ensemble learning. In addition, a random forest variant for response variables measured at arbitrary scales based on conditional inference trees is implemented in packageparty.randomForestSRC implements a unified treatment of Breiman’s random forests for survival, regression and classification problems. Quantile regression forestsquantregForest allow to regress quantiles of a numeric response on exploratory variables via a random forest approach. For binary data, ThevarSelRF andBoruta packages focus on variable selection by means for random forest algorithms. In addition, packagesranger andRborist offer R interfaces to fast C++ implementations of random forests. Reinforcement Learning Trees, featuring splits in variables which will be important down the tree, are implemented in packageRLT.wsrf implements an alternative variable weighting method for variable subspace selection in place of the traditional random variable sampling. PackageRGF is an interface to a Python implementation of a procedure called regularized greedy forests. Random forests for parametric models, including forests for the estimation of predictive distributions, are available in packagestrtf (predictive transformation forests, possibly under censoring and truncation) andgrf (an implementation of generalised random forests).
Regularized and Shrinkage Methods : Regression models with some constraint on the parameter estimates can be fitted with thelars package. Lasso with simultaneous updates for groups of parameters (groupwise lasso) is available in packagegrplasso; thegrpreg package implements a number of other group penalization models, such as group MCP and group SCAD. The L1 regularization path for generalized linear models and Cox models can be obtained from functions available in packageglmpath, the entire lasso or elastic-net regularization path (also inelasticnet) for linear regression, logistic and multinomial regression models can be obtained from packageglmnet. Theeasy.glmnet is a companion to support the usage of glmnet. Thepenalized package provides an alternative implementation of lasso (L1) and ridge (L2) penalized regression models (both GLM and Cox models). PackageRXshrink can be used to generate TRACE displays that identify the extent of shrinkage with Maximum Likelihood of Minimum MSE Risk when errors are IID Normal. Semiparametric additive hazards models under lasso penalties are offered by packageahaz. The shrunken centroids classifier and utilities for gene expression analyses are implemented in packagepamr. An implementation of multivariate adaptive regression splines is available in packageearth. Various forms of penalized discriminant analysis are implemented in packageshda andsda. PackageLiblineaR offers an interface to the LIBLINEAR library. Thencvreg package fits linear and logistic regression models under the the SCAD and MCP regression penalties using a coordinate descent algorithm. The Lasso under non-Gaussian and heteroscedastic errors is estimated byhdm, inference on low-dimensional components of Lasso regression and of estimated treatment effects in a high-dimensional setting are also contained. PackageSIS implements sure independence screening in generalised linear and Cox models. Elastic nets for correlated outcomes are available from packagejoinet. Robust penalized generalized linear models and robust support vector machines are fitted by packagempath using composite optimization by conjugation operator. Theislasso package provides an implementation of lasso based on the induced smoothing idea which allows to obtain reliable p-values for all model parameters. Best-subset selection for linear, logistic, Cox and other regression models, based on a fast polynomial time algorithm, is available from packageabess.
Boosting and Gradient Descent : Various forms of gradient boosting are implemented in packagegbm (tree-based functional gradient descent boosting). Packagelightgbm andxgboost implement tree-based boosting using efficient trees as base learners for several and also user-defined objective functions. The Hinge-loss is optimized by the boosting implementation in packagebst. An extensible boosting framework for generalized linear, additive and nonparametric models is available in packagemboost. Likelihood-based boosting for mixed models is implemented inGMMBoost. GAMLSS models can be fitted using boosting bygamboostLSS.adabag implements the classical AdaBoost algorithm with added functionality, such as variable importances.
Support Vector Machines and Kernel Methods : The functionsvm() frome1071 offers an interface to the LIBSVM library and packagekernlab implements a flexible framework for kernel learning (including SVMs, RVMs and other kernel learning algorithms). An interface to the SVMlight implementation (only for one-against-all classification) is provided in packageklaR. PackagegKRLS features Generalized Kernel Regularized Least Squares, applicable to non-gaussian data alongside random effects, splines, and unregularized fixed effects.
Bayesian Methods : Bayesian Additive Regression Trees (BART), where the final model is defined in terms of the sum over many weak learners (not unlike ensemble methods), are implemented in packagesBayesTree,BART, andbartMachine. Bayesian nonstationary, semiparametric nonlinear regression and design by treed Gaussian processes including Bayesian CART and treed linear models are made available by packagetgp. Bayesian structure learning in undirected graphical models for multivariate continuous, discrete, and mixed data is implemented in packageBDgraph; corresponding methods relying on spike-and-slab priors are available from packagessgraph. Naive Bayes classifiers are available innaivebayes.
Optimization using Genetic Algorithms : Packagergenoud offers optimization routines based on genetic algorithms. The packageRmalschains implements memetic algorithms with local search chains, which are a special type of evolutionary algorithms, combining a steady state genetic algorithm with local search for real-valued parameter optimization.
Association Rules : Packagearules provides both data structures for efficient handling of sparse binary data as well as interfaces to implementations of Apriori and Eclat for mining frequent itemsets, maximal frequent itemsets, closed frequent itemsets and association rules. Packageopusminer provides an interface to the OPUS Miner algorithm (implemented in C++) for finding the key associations in transaction data efficiently, in the form of self-sufficient itemsets, using either leverage or lift.
Fuzzy Rule-based Systems : Packagefrbs implements a host of standard methods for learning fuzzy rule-based systems from data for regression and classification. PackageRoughSets provides comprehensive implementations of the rough set theory (RST) and the fuzzy rough set theory (FRST) in a single package.
Model selection and validation : Packagee1071 has functiontune() for hyper parameter tuning and functionerrorest() (ipred) can be used for error rate estimation. The cost parameter C for support vector machines can be chosen utilizing the functionality of packagesvmpath. Data splitting for crossvalidation and other resampling schemes is available in thesplitTools package. Packagenestedcv provides nested cross-validation forglmnet andcaret models. Functions for ROC analysis and other visualisation techniques for comparing candidate classifiers are available from packageROCR. Packageshdi andstabs implement stability selection for a range of models,hdi also offers other inference procedures in high-dimensional models.
Causal Machine Learning : The packageDoubleML is an object-oriented implementation of the double machine learning framework in a variety of causal models. Building upon themlr3 ecosystem, estimation of causal effects can be based on an extensive collection of machine learning methods.
Other procedures : Evidential classifiers quantify the uncertainty about the class of a test pattern using a Dempster-Shafer mass function in packageevclass. TheOneR (One Rule) package offers a classification algorithm with enhancements for sophisticated handling of missing values and numeric data together with extensive diagnostic functions. Themlr3inferr allows to construct confidence intervals for the generalization error using resampling-based inference methods.
Meta packages : Packagetidymodels provides miscellaneous functions for building predictive models, including parameter tuning and variable importance measures. In a similar spirit, packagemlr3 offers high-level interfaces to various statistical and machine learning packages. PackageSuperLearner implements a similar toolbox. Theh2o package implements a general purpose machine learning platform that has scalable implementations of many popular algorithms such as random forest, GBM, GLM (with elastic net regularization), and deep learning (feedforward multilayer networks), among others. An interface to the mlpack C++ library is available from packagemlpack.CORElearn implements a rather broad class of machine learning algorithms, such as nearest neighbors, trees, random forests, and several feature selection methods. Similar, packagerminer interfaces several learning algorithms implemented in other packages and computes several performance measures. PackageqeML provides wrappers to numerous machine learning R packages with a simple, convenient, and uniform interface, for both beginner and advanced operations such asFOCI andncvreg.
Visualisation (initially contributed by Brandon Greenwell) Thestats::termplot() function package can be used to plot the terms in a model whose predict method supportstype="terms". Theeffects package provides graphical and tabular effect displays for models with a linear predictor (e.g., linear and generalized linear models). Friedman’s partial dependence plots (PDPs), that are low dimensional graphical renderings of the prediction function, are implemented in a few packages.gbm,randomForest andrandomForestSRC provide their own functions for displaying PDPs, but are limited to the models fit with those packages (the functionpartialPlot fromrandomForest is more limited since it only allows for one predictor at a time). Packagespdp,plotmo, andICEbox are more general and allow for the creation of PDPs for a wide variety of machine learning models (e.g., random forests, support vector machines, etc.); bothpdp andplotmo support multivariate displays (plotmo is limited to two predictors whilepdp uses trellis graphics to display PDPs involving three predictors). By default,plotmo fixes the background variables at their medians (or first level for factors) which is faster than constructing PDPs but incorporates less information.ICEbox focuses on constructing individual conditional expectation (ICE) curves, a refinement over Friedman’s PDPs. ICE curves, as well as centered ICE curves can also be constructed with thepartial() function from thepdp package.
XAI : Most packages and functions from the last section “Visualization” belong to the field of explainable artificial intelligence (XAI). The meta packagesDALEX andiml offer different methods to interpret any model, including partial dependence, accumulated local effects, and permutation importance. SHAP (fromSHapleyAdditive exPlanations) is one of the most frequently used techniques to interpret ML models. It decomposes - in a fair way - predictions into additive contributions of the predictors. For tree-based models, the very fast TreeSHAP algorithm exists. It is shipped directly withh2o,xgboost, andlightgbm. Model-agnostic implementations of SHAP are available in additional packages:fastshap mainly uses Monte-Carlo sampling to approximate SHAP values, whileshapr andkernelshap provide implementations of KernelSHAP. SHAP values of any of these packages can be plotted by the packageshapviz. A port to Python’s “shap” package is provided inshapper. Alternative decompositions of predictions are implemented inlime andiBreakDown.
Performance evaluation:mlr3measures,yardstick,MLmetrics andSLmetrics provide a wide array of classification, regression and clustering metrics for machine learning tasks. mlr3measures is a part of the mlr3verse framework, yardstick is built with tidyverse for the tidymodels framework. MLmetrics and SLmetrics are standalone packages built in base ‘R’ and ‘C++’, respectively.