FastML

Author

Sergio Uribe

pacman::p_load(fastml, 
               xgboost, 
               kernlab, 
               tidyverse, 
               mlbench)
# Example dataset
data(iris)
iris <- iris[iris$Species != "setosa", ]  # Binary classification
iris$Species <- factor(iris$Species)
# Train models
model <- fastml(
  data = iris,
  label = "Species"
)
Loading required package: lattice

Attaching package: 'caret'
The following object is masked from 'package:purrr':

    lift
# View model summary
summary(model)

===== fastml Model Summary =====
Best Model: random_forest 

Performance Metrics for All Models:

         Model Accuracy Kappa Sensitivity Specificity Precision        F1
 random_forest     0.95   0.9         0.9           1         1 0.9473684
       xgboost     0.90   0.8         0.8           1         1 0.8888889
    svm_radial     0.90   0.8         0.8           1         1 0.8888889

Best Model Hyperparameters:

 mtry
    2

Generating performance comparison plots...


To make predictions, use the 'predict' function.
=================================
# Create a sample new dataset for predictions
new_data <- data.frame(
  Sepal.Length = c(5.1, 4.9, 4.7),
  Sepal.Width = c(3.5, 3.0, 3.2),
  Petal.Length = c(1.4, 1.4, 1.3),
  Petal.Width = c(0.2, 0.2, 0.2)
)
# Make predictions using the 'predict' function
predictions <- predict(model, new_data)
# Print the predictions
print(predictions)
[1] versicolor versicolor versicolor
Levels: versicolor virginica