Multi-Label Prediction Using Gibbs Sampling (and Classifier Chains)
An implementation of classifier chains (CCs) for multi-label prediction. Users can employ an external package (e.g. ‘randomForest’, ‘C50’), or supply their own. The package can train a single set of CCs or train an ensemble of CCs – in parallel if running in a multi-core environment. New observations are classified using a Gibbs sampler since each unobserved label is conditioned on the others. The package includes methods for evaluating the predictions for accuracy and aggregating across iterations and models to produce binary or probabilistic classifications.
if ( !('devtools' %in% installed.packages()) ) install.packages("devtools")
::install_github("bearloga/MLPUGS") # or...
devtools::install_github("bearloga/MLPUGS", build_vignettes = TRUE) devtools
<- ecc(x, y)
fit <- predict(fit, x_new)
preds <- summary(preds) y_pred
For a detailed tutorial, please see
browseVignettes(package="MLPUGS")
.
Currently, there is no built-in classifier in version 0.1.1, but users can supply their own or use an existing package. For example:
# Random Forest:
<- function(x, y) randomForest::randomForest(x, y)
foo_train <- function(x, newdata) randomForest:::predict.randomForest(x, newdata, type = "prob")
foo_predict
# C5.0:
<- function(x, y) C50::C5.0(x, y)
foo_train <- function(x, newdata) C50::predict.C5.0(x, newdata, type = "prob")
foo_predict
<- ecc(x, y, .f = foo_train)
fit <- predict(fit, x_new, .f = foo_predict)
pugs <- summary(pugs, type = "prob")
y_pred
<- ecc(x, y, .f = foo_train) %>%
y_pred predict(x_new, .f = foo_predict) %>%
summary(type = "prob")
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.