Analyze, Wrap, Explain: Modeling and Explainable Machine Learning

Provides a single, coherent workflow that carries a data set from import through exploratory data analysis, automatic model selection across a broad bank of regression and classification learners, model wrapping, ensembling, hyperparameter tuning, explainability (permutation importance, partial dependence, individual conditional expectation, and optional SHAP/LIME via 'DALEX'/'iml' when installed), evaluation, narrative storytelling, and reporting. The name 'awe' stands for the three pillars of the package: Analyze, Wrap, Explain. A single call to awe() returns an 'awe' object that can be summarized, plotted, explained, and reported with simple generic methods (summary(), plot(), explain(), report(), predict()). A consistent, 'ggplot2'-based visual identity (theme_awe(), awe_palette()) is used throughout, with base-graphics fallbacks so the package never requires a plotting dependency.


awe: Analyze, Wrap, Explain

awe is an end-to-end R framework that carries a data set through the entire analytical workflow in one call:

Import -> Explore -> Model -> Ensemble/Tune -> Wrap -> Explain -> Evaluate -> Communicate

Installation

# from a local source tarball
install.packages("awe_0.2.0.tar.gz", repos = NULL, type = "source")

# or, once pushed to GitHub
# install.packages("remotes")
remotes::install_github("olawaleawe/awe")

Quick start

library(awe)

fit <- awe(mtcars, target = "mpg")            # silent by default in scripts
fit <- awe(mtcars, target = "mpg", verbose = TRUE)  # progress via message()

summary(fit)                          # exploratory summary + leaderboard + evaluation + story
plot(fit)                             # permutation importance
plot(fit, type = "pdp", var = "wt")   # partial dependence (with ICE curves)
plot(fit, type = "leaderboard")       # cross-validated model comparison
plot(fit, type = "residuals")         # regression diagnostics (continuous targets)
predict(fit)                          # predictions on the training split
explain(fit)                          # AWEExplainer object
report(fit, format = "html")          # writes a report (HTML if rmarkdown/pandoc available)

Classification works the same way: the target type (continuous, binary, multiclass) is detected automatically, and binary targets additionally get ROC/AUC and a confusion-matrix heatmap:

fit <- awe(iris, target = "Species")
plot(fit, type = "roc")         # binary targets only
plot(fit, type = "confusion")

Step-by-step (each stage is also its own function)

e    <- awe_explore(mtcars, target = "mpg")
sp   <- awe_preprocess(mtcars, target = "mpg")
m    <- awe_model(sp$train, target = "mpg")
ens  <- awe_ensemble(m, top_n = 3)      # performance-weighted ensemble of top candidates
tn   <- awe_tune(sp$train, target = "mpg", model = "random_forest")  # grid-search tuning
w    <- awe_wrap(m)
xp   <- awe_explain(w)
ev   <- awe_evaluate(w, newdata = sp$test)
st   <- awe_story(list(explore = e, model = m, explainer = xp, evaluation = ev))

Design

  • Analyze: awe_explore(), eda_univariate(), eda_bivariate(), eda_report() (combined multi-panel overview), awe_preprocess() (with stratified train/test splitting), awe_select_features() (near-zero-variance, correlation, and univariate filters), awe_model() (automatic candidate model selection with k-fold cross-validation, in the spirit of caret::train()), awe_registry() (list every candidate available without fitting anything), and awe_tune() (grid-search hyperparameter tuning for decision_tree / random_forest / glmnet / svm_radial).
  • Wrap: awe_wrap() bundles any fitted model into a single AWEWrapper object with a consistent predict() interface. Use which = to wrap any specific candidate, not just the overall best. awe_ensemble() combines the top-N cross-validated candidates into a performance-weighted ensemble (weighted average for regression, weighted vote for classification) that behaves like any other AWEWrapper. awe_save() / awe_load() persist any AWE object to/from disk.
  • Explain: awe_explain() computes permutation importance and partial dependence / ICE curves in base R, adds SHAP-style variable importance automatically when DALEX is installed, and varImp() gives a caret-style importance table (using each engine's native importance measure when available, permutation importance otherwise).
  • Compare: awe_compare() stacks the leaderboards of several runs (e.g. different feature sets) side by side, with a grouped-bar plot() method.

Model bank

Base learners (lm/glm, rpart, and a dependency-free k-NN) always run so awe_model() never fails for lack of a suggested package. When installed, these are added automatically as extra candidates. Call awe_registry("continuous") / awe_registry("binary") / awe_registry("multiclass") to list everything that would be tried, without fitting anything.

Package Candidate(s)
randomForest Random forest
ranger Fast random forest (+ probability variant)
nnet Multinomial logistic / neural net
e1071 SVM (radial & linear), naive Bayes
kernlab SVM (ksvm, radial)
glmnet Ridge, lasso, elastic net, regularized logistic
gbm Gradient boosting
class k-nearest neighbours (classification)
MASS LDA, QDA, robust regression (rlm)
earth MARS
pls Partial least squares regression
xgboost XGBoost

Restrict the candidates tried with awe_model(data, target, models = c(...)).

Plots

A consistent visual identity (theme_awe(), awe_palette()) is used throughout; every plotting function uses ggplot2 when installed and falls back to base graphics otherwise, so nothing here requires a specific plotting package.

  • eda_univariate() / eda_bivariate() / eda_report(): distribution, relationship, and combined multi-panel overview plots
  • plot_correlation(): correlation heatmap
  • plot_missingness(): missing-value overview
  • plot_feature_selection(): univariate association scores, selected vs. dropped
  • plot_leaderboard(): cross-validated model comparison
  • plot_tree(): visualise a decision-tree candidate (rpart.plot if installed)
  • plot_roc(): ROC curve + rank-based AUC for binary targets
  • plot_confusion(): confusion-matrix heatmap
  • plot_residuals(): residuals-vs-fitted and normal Q-Q (continuous targets)
  • plot(varImp(wrapper)): variable importance bar chart
  • plot(cmp): grouped-bar comparison across awe_compare() runs
  • plot(fit, type = c("importance","pdp","leaderboard","tree","roc","confusion","residuals")): all of the above directly from a full awe() result

Everything degrades gracefully: the package depends only on base R plus rpart, so awe() always runs. Every other engine listed above is optional (Suggests) and used automatically whenever installed.

Status

v0.2.0: passes R CMD check cleanly (one environment-only NOTE about suggested packages not installable offline) with a 36-test testthat suite. Routine engine warnings/messages (convergence notices, verbosity from glm/nnet/glmnet/gbm/etc.) are suppressed internally so awe() output stays readable; genuine fitting failures still surface with an informative message and that one candidate is dropped.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("awe")

0.2.3 by Olushina Olawale Awe, 13 hours ago


https://github.com/olawaleawe/awe


Report a bug at https://github.com/olawaleawe/awe/issues


Browse source code at https://github.com/cran/awe


Authors: Olushina Olawale Awe [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports stats, utils, graphics, grDevices, rpart

Suggests ggplot2, randomForest, ranger, xgboost, nnet, e1071, kernlab, glmnet, gbm, class, MASS, earth, pls, corrplot, rpart.plot, patchwork, gridExtra, scales, viridis, DALEX, iml, rmarkdown, knitr, testthat


See at CRAN