
fastml is a streamlined R package designed tosimplify the training, evaluation, and comparison of multiple machinelearning models. It offers comprehensive data preprocessing, supports awide range of algorithms with hyperparameter tuning, and providesperformance metrics alongside visualization tools to facilitateefficient and effective machine learning workflows.
You can install the latest stable version offastmlfrom CRAN using:
install.packages("fastml")You can install all dependencies (additional models) using:
# install all dependencies - recommendedinstall.packages("fastml",dependencies =TRUE)For the development version, install directly from GitHub using thedevtools package:
# Install devtools if you haven't alreadyinstall.packages("devtools")# Install fastml from GitHubdevtools::install_github("selcukorkmaz/fastml")Here’s a simple workflow to get you started with fastml:
library(fastml)# Example datasetdata(iris)iris<- iris[iris$Species!="setosa", ]# Binary classificationiris$Species<-factor(iris$Species)# Train modelsmodel<-fastml(data = iris,label ="Species")# View model summarysummary(model)fastml supports both grid search and Bayesian optimization throughthetuning_strategy argument. Use"grid" for aregular parameter grid or"bayes" for Bayesianhyperparameter search. Thetuning_iterations parametercontrols the number of iterationsonly whentuning_strategy = "bayes" and is ignored otherwise.
fastexplain() provides several ways to understandtrained models. Set themethod argument to choose anapproach:
# LIME explanationsexplain_lime(model)# ICE curvesfastexplain(model,method ="ice",features ="Sepal.Length")# Accumulated Local Effectsfastexplain(model,method ="ale",features ="Sepal.Length")# Surrogate treefastexplain(model,method ="surrogate")# Interaction strengthfastexplain(model,method ="interaction")# Counterfactual explanation for a single observationfastexplain(model,method ="counterfactual",observation = iris[1, ])