Home

Awesome

Model verification, validation, and error analysis <img src="man/figures/logo.png" align="right" width="150"/>

CRAN_Status_Badge R build status Coverage Status DrWhy-eXtrAI

Overview

Package auditor is a tool for model-agnostic validation. Implemented techniques facilitate assessing and comparing the goodness of fit and performance of models. In addition, they may be used for the analysis of the similarity of residuals and for the identification of outliers and influential observations. The examination is carried out by diagnostic scores and visual verification. Due to the flexible and consistent grammar, it is simple to validate models of any classes.

An up-to-date paper about auditor and a shorter version in The R-Journal.

auditor is a part of DrWhy collection of tools for Visual Exploration, Explanation and Debugging of Predictive Models.

auditor’s pipeline: model %>% DALEX::explain() %>% plot(type=…)

Installation

Stable version from CRAN:

install.packages("auditor")

Developer version from GitHub:

source("https://install-github.me/ModelOriented/auditor")

# or with the devtools package
devtools::install_github("ModelOriented/auditor")

Demo

Run the code below or try the auditor.

library(auditor)
library(randomForest)
data(mtcars)

# fitting models
model_lm <- lm(mpg ~ ., data = mtcars)
set.seed(123)
model_rf <- randomForest(mpg ~ ., data = mtcars)

# creating objects with 'explain' function from the package DALEX
# that contains all necessary components required for further processing
exp_lm <- DALEX::explain(model_lm, data = mtcars, y = mtcars$mpg,  verbose = FALSE)
exp_rf <- DALEX::explain(model_rf, data = mtcars, y = mtcars$mpg, label = "rf", verbose = FALSE)

# create explanation  objects
mr_lm <- model_residual(exp_lm)
mr_rf <- model_residual(exp_rf)

# generating plots
plot_residual(mr_lm, mr_rf, variable = "wt", smooth = TRUE)

<!-- -->

More Resources

Short overview of plots

Column type contains character that should be passed to parameter type= when using plot() function. Regr and Class columns indicate whether plot can be used for regression and classification models.

Name of a plotFunctionInteractive versionTypeRegrClass
Autocorrelation Functionplot_acf()plotD3_acf()“acf”yesyes
Autocorrelationplot_autocorrelation()plotD3_autocorrelation()“autocorrelation”yesyes
Influence of Observationsplot_cooksdistance()plotD3_cooksdistance()“cooksdistance”yesyes
Half-Normalplot_halfnormal()plotD3_halfnormal()“halfnormal”yesyes
LIFT Chartplot_lift()plotD3_lift()“lift”noyes
Model Correlationplot_correlation()-“correlation”yesyes
Principal Component Analysis of Modelsplot_pca()-“pca”yesyes
Model Ranking Radar Plotplot_radar()-“radar”yesyes
Predicted Response vs Actual or Variable Valuesplot_prediction()plotD3_prediction()“prediction”yesyes
Regression Error Characteristic Curve (REC)plot_rec()plotD3_rec()“rec”yesyes
Plot Residuals vs Actual, Fitted or Variable Valuesplot_residual()plotD3_residual()“residual”yesyes
Residual Boxplotplot_residual_boxplot()-“residual_boxplot”yesyes
Residual Densityplot_residual_density()-“residual_density”yesyes
Receiver Operating Characteristic (ROC) Curveplot_roc()plotD3_roc“roc”noyes
Regression Receiver Operating Characteristic (RROC)plot_rroc()plotD3_rroc“rroc”yesyes
Scale-Location Plotplot_scalelocation()plotD3_scalelocation()“scalelocation”yesyes
Two-sided Cumulative Distribution Functionplot_tsecdf()-“tsecdf”yesyes

Acknowledgments

Work on this package was financially supported by the NCN Opus grant 2016/21/B/ST6/02176.