Sequentially train top ranked algorithms on each class ordered by class performance and predict a given class using the sequentially trained fits.
sequential_train(sm, data, class, boxplot = FALSE)
sequential_pred(fit, sm, data, class, boxplot = FALSE)
a splendid_model
object
data frame with rows as samples, columns as features
true/reference class vector used for supervised learning
if TRUE
, boxplots are plotted showing the distribution of
F1-scores per class, for every algorithm.
list of fitted models from sequential_train
sequential_train
returns a list of fits over the top-ranked
sequence.
sequential_pred
returns a list of two elements
prob
: predicted sequential probabilities
cm
: confusion matrices for each class
sequential_train
sequentially trains One-Vs-All models until all classes
have been classified. Hence for n
classes, there are n - 1
sequential
fits. sequential_pred
predicts class membership for each One-Vs-All
sequential model. Performance is evaluated on by-class F1-scores, since these
are better for evaluation than other metrics such as accuracy, precision, and
recall.
dat <- iris[, 1:4]
class <- iris$Species
sm <- splendid_model(dat, class, n = 2, algorithms = c("slda", "xgboost"))
st <- sequential_train(sm, dat, class)
sp <- sequential_pred(st, sm, dat, class)