Learn R Programming

lares (version 4.8.4)

conf_mat: Confussion Matrix

Description

This function calculates a Confussion Matrix using crosstab for 2 or more categories. You can either set the score and threshold or the labels you wish to cross with.

Usage

conf_mat(tag, score, thresh = 0.5, sense = ">=", plot = FALSE)

Arguments

tag

Vector. Real known label

score

Vector. Predicted value or model's result

thresh

Numeric. Value which splits the results for the confusion matrix when binary.

sense

Character. Inequation sense for threshhold: <, <=, >=, >

plot

Boolean. Plot result? Uses mplot_conf()

Details

You may use mplot_conf() or set `plot` parameter to `TRUE`.

See Also

Other Machine Learning: ROC(), clusterKmeans(), export_results(), gain_lift(), h2o_automl(), h2o_predict_API(), h2o_predict_MOJO(), h2o_predict_binary(), h2o_predict_model(), h2o_results(), h2o_selectmodel(), impute(), iter_seeds(), lasso_vars(), model_metrics(), msplit()

Other Model metrics: ROC(), errors(), gain_lift(), loglossBinary(), model_metrics()

Examples

Run this code
# NOT RUN {
data(dfr) # Results for AutoML Predictions
lapply(dfr[c(1,2)], head)

# Results for Binomial Model
conf_mat(dfr$class2$tag, dfr$class2$scores)
conf_mat(dfr$class2$tag, dfr$class2$scores, thresh = 0.3)
conf_mat(dfr$class2$tag, dfr$class2$scores, sense = "<=")

# Results for Multi-Categorical Model
conf_mat(dfr$class3$tag, dfr$class3$score)
# }

Run the code above in your browser using DataLab