mlm_classification {stressor}R Documentation

Fit Machine Learning Classification Models

Description

Through the PyCaret module from 'python', this function fits many machine learning models simultaneously without requiring any 'python' programming on the part of the user. This function is specifically designed for the classification models fitted by 'PyCaret'.

Usage

mlm_classification(
  formula,
  train_data,
  fit_models = c("ada", "et", "lightgbm", "dummy", "lr", "rf", "ridge", "knn", "dt",
    "gbc", "svm", "lda", "nb", "qda"),
  sort_v = c("Accuracy", "AUC", "Recall", "Precision", "F1", "Kappa", "MCC"),
  n_models = 9999,
  seed = NULL,
  ...
)

Arguments

formula

The classification formula, as a formula object.

train_data

A data.frame object that includes data to be trained on.

fit_models

A character vector with all the possible Machine Learning classifiers that are currently being fit, the user may specify a subset of them using a character vector.

ada AdaBoost Classifier
dt Decision Tree Classifier
dummy Dummy Classifier
et Extra Trees Classifier
gbc Gradient Boosting Classifier
knn K Neighbors Classifier
lda Linear Discriminant Analysis
lightgbm Light Gradient Boosting Machine
lr Logistic Regression
nb Naive Bayes
qda Quadratic Discriminant Analysis
rf Random Forest Classifier
ridge Ridge Classifier
svm SVM - Linear Kernel
sort_v

A character vector indicating what to sort the tuned models on.

n_models

An integer value defaulted to a large integer value to return all possible models.

seed

An integer value to set the seed of the 'python' environment. Default value is set to 'NULL'.

...

Additional arguments passed onto mlm_init.

Details

'PyCaret' is a 'python' module where machine learning models can be fitted with little coding by the user. The pipeline that 'PyCaret' uses is a setup function to parameterize the data that is easy for all the models to fit on. Then the compare models function is executed, which fits all the models that are currently available. This process takes less than five minutes for data.frame objects that are less than 10,000 rows.

Value

A list object where the first entry is the models fitted and the second is the initial predictive accuracy on the random test data. Returns as two classes '"mlm_stressor"' and '"classifier"'.

Examples


 lm_test <- data_gen_lm(20)
 binary_response <- sample(c(0, 1), 20, replace = TRUE)
 lm_test$Y <- binary_response
 mlm_class <- mlm_classification(Y ~ ., lm_test)


[Package stressor version 0.2.0 Index]