The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Most R packages stop once a model is fitted. Very few carry a user through the entire analytical workflow:
Import -> Explore -> Model -> Wrap -> Explain -> Evaluate -> Communicate
awe (Analyze, Wrap, Explain) is a single, coherent
interface over that whole pipeline. It depends only on base R plus
rpart, so it always runs; packages like
ggplot2, randomForest, xgboost,
nnet, and DALEX are used automatically when
installed, for nicer plots, more model candidates, and SHAP-style
explanations.
The call above walks through six stages and prints a running log: exploratory summary, preprocessing (missing-value imputation and a stratified train/test split), automatic model selection with cross-validation, wrapping the winning model in a common interface, explainability, and evaluation on the held-out test set.
The returned object supports familiar generics:
summary(fit)
#> ========== AWE Analysis Summary ==========
#> AWE Exploratory Summary
#> Rows: 32 | Columns: 11
#> Numeric variables: 11 | Categorical variables: 0
#> No missing values detected.
#>
#> Numeric summary:
#> mean sd min q25 median q75 max skewness kurtosis
#> mpg 20.091 6.027 10.400 15.425 19.200 22.80 33.900 0.611 -0.373
#> cyl 6.188 1.786 4.000 4.000 6.000 8.00 8.000 -0.175 -1.762
#> disp 230.722 123.939 71.100 120.825 196.300 326.00 472.000 0.382 -1.207
#> hp 146.688 68.563 52.000 96.500 123.000 180.00 335.000 0.726 -0.136
#> drat 3.597 0.535 2.760 3.080 3.695 3.92 4.930 0.266 -0.715
#> wt 3.217 0.978 1.513 2.581 3.325 3.61 5.424 0.423 -0.023
#> qsec 17.849 1.787 14.500 16.892 17.710 18.90 22.900 0.369 0.335
#> vs 0.438 0.504 0.000 0.000 0.000 1.00 1.000 0.240 -2.002
#> am 0.406 0.499 0.000 0.000 0.000 1.00 1.000 0.364 -1.925
#> gear 3.688 0.738 3.000 3.000 4.000 4.00 5.000 0.529 -1.070
#> carb 2.812 1.615 1.000 2.000 2.000 4.00 8.000 1.051 1.257
#> n_outliers
#> mpg 1
#> cyl 0
#> disp 0
#> hp 1
#> drat 0
#> wt 3
#> qsec 1
#> vs 0
#> am 0
#> gear 0
#> carb 1
#>
#> AWE Model Selection
#> Target: mpg (continuous)
#> Candidates tried: 14
#> Leaderboard:
#> model metric mean_score sd_score
#> gradient_boosting RMSE 2.794120 0.5172574
#> ranger RMSE 2.849956 0.5637010
#> random_forest RMSE 2.880504 0.5093567
#> mars RMSE 3.245521 0.3023847
#> knn_regression RMSE 3.695095 0.4455940
#> ridge_regression RMSE 3.825165 0.9555778
#> svm_radial RMSE 3.900662 1.2490972
#> elastic_net RMSE 4.087515 1.5489662
#> lasso_regression RMSE 4.410835 2.0204418
#> svm_linear RMSE 5.295902 2.3660430
#> pls_regression RMSE 5.808063 3.5214919
#> decision_tree RMSE 6.158014 1.1204867
#> robust_regression RMSE 7.346871 4.3613038
#> linear_regression RMSE 7.399377 5.2582285
#> Best model: gradient_boosting
#>
#> AWE Evaluation
#> RMSE: 1.8639 | MAE: 1.3358 | MAPE: 7.23% | R2: 0.9249
#>
#> ## Executive Summary
#> The data set contains 32 observations across 11 variables (11 numeric, 0 categorical). No missing values were detected.
#>
#> ## Key Findings
#> - Among 14 candidate models evaluated for 'mpg' (continuous target), 'gradient_boosting' performed best with a cross-validated RMSE of 2.7941.
#> - The single most influential predictor of 'mpg' is 'hp', based on permutation importance.
#> - On held-out test data the model explains 92.5% of the variance in 'mpg' (R2 = 0.925, RMSE = 1.864).
#>
#> ## Recommendations
#> - Prioritise 'gradient_boosting' as the recommended production model given its cross-validated performance.
#> - Focus data-collection and intervention efforts on 'hp', the top driver identified.
#> - Validate findings on new/unseen data before deployment, and monitor performance drift over time.
#>
#> ## Limitations
#> - Model selection was limited to the candidate learners available in this environment.
#> - Explanations (permutation importance, PDP) are approximate and depend on the chosen sample.
#> - Causal claims should not be drawn from associative model output alone.
predict(fit, newdata = mtcars[1:5, ])
#> [1] 20.73249 20.73249 23.28327 20.85339 17.00984The target type – continuous, binary, or multiclass – is detected automatically, so no extra arguments are needed for a classification problem:
fit_iris$model$leaderboard
#> model metric mean_score sd_score
#> 1 qda Accuracy 1.0000000 0.00000000
#> 2 lda Accuracy 0.9912281 0.01519343
#> 3 svm_kernlab Accuracy 0.9824561 0.01519343
#> 4 regularized_logistic Accuracy 0.9824561 0.03038686
#> 5 svm_linear Accuracy 0.9824561 0.03038686
#> 6 logistic_or_multinomial Accuracy 0.9736842 0.02631579
#> 7 random_forest Accuracy 0.9736842 0.02631579
#> 8 ranger Accuracy 0.9736842 0.02631579
#> 9 ranger_prob Accuracy 0.9736842 0.02631579
#> 10 neural_net Accuracy 0.9736842 0.02631579
#> 11 svm_radial Accuracy 0.9736842 0.02631579
#> 12 decision_tree Accuracy 0.9649123 0.03038686
#> 13 naive_bayes Accuracy 0.9649123 0.01519343
#> 14 knn Accuracy 0.9649123 0.01519343
fit_iris$evaluation
#> AWE Evaluation
#> Accuracy: 0.9444 | Macro-Precision: 0.9524 | Macro-Recall: 0.9444 | Macro-F1: 0.9441
#> Confusion matrix:
#> Predicted
#> Actual setosa versicolor virginica
#> setosa 12 0 0
#> versicolor 0 10 2
#> virginica 0 0 12Every stage of awe() is also available on its own, for
users who want to customise or swap out a step (for example, plugging in
their own preprocessing before modelling):
ex <- awe_explore(mtcars, target = "mpg")
sp <- awe_preprocess(mtcars, target = "mpg", stratify = TRUE, seed = 1)
mo <- awe_model(sp$train, target = "mpg", k = 3, seed = 1)
wr <- awe_wrap(mo)
xp <- awe_explain(wr, newdata = sp$train)
ev <- awe_evaluate(wr, newdata = sp$test)
mo$leaderboard
#> model metric mean_score sd_score
#> 1 gradient_boosting RMSE 2.794120 0.5172574
#> 2 ranger RMSE 2.849956 0.5637010
#> 3 random_forest RMSE 2.880504 0.5093567
#> 4 mars RMSE 3.245521 0.3023847
#> 5 knn_regression RMSE 3.695095 0.4455940
#> 6 ridge_regression RMSE 3.825165 0.9555778
#> 7 svm_radial RMSE 3.900662 1.2490972
#> 8 elastic_net RMSE 4.087515 1.5489662
#> 9 lasso_regression RMSE 4.410835 2.0204418
#> 10 svm_linear RMSE 5.295902 2.3660430
#> 11 pls_regression RMSE 5.808063 3.5214919
#> 12 decision_tree RMSE 6.158014 1.1204867
#> 13 robust_regression RMSE 7.346871 4.3613038
#> 14 linear_regression RMSE 7.399377 5.2582285
xp$importance
#> variable importance
#> 3 hp 2.19047432
#> 5 wt 1.16092727
#> 2 disp 0.85527034
#> 6 qsec 0.48526947
#> 1 cyl 0.28087528
#> 4 drat 0.22596947
#> 8 am 0.01757179
#> 7 vs 0.00000000
#> 9 gear 0.00000000
#> 10 carb 0.00000000
ev$metrics
#> $RMSE
#> [1] 1.863931
#>
#> $MAE
#> [1] 1.335819
#>
#> $MAPE
#> [1] 7.227674
#>
#> $R2
#> [1] 0.9249257awe_preprocess() stratifies the split by default: for a
categorical target it samples test_prop from each class so
proportions match between train and test; for a continuous target it
stratifies by quartile bins of the target so both sets span a similar
range.
sp <- awe_preprocess(iris, target = "Species", test_prop = 0.3, stratify = TRUE, seed = 1)
prop.table(table(sp$train$Species))
#>
#> setosa versicolor virginica
#> 0.3333333 0.3333333 0.3333333
prop.table(table(sp$test$Species))
#>
#> setosa versicolor virginica
#> 0.3333333 0.3333333 0.3333333Set stratify = FALSE for a plain random split
instead.
awe_story() drafts a plain-language executive summary,
key findings, recommendations, and limitations from the pieces above;
awe_report() writes this out as a self-contained Markdown
file (and to HTML when rmarkdown and Pandoc are
available):
awe_select_features() screens predictors before
modelling: a near-zero-variance filter, a pairwise correlation filter
(numeric predictors), and a univariate association score against the
target (correlation, ANOVA F, or Cramer’s V depending on variable
types). Pass select_features = TRUE (and optionally
top_n_features) to awe() to run it as part of
the pipeline, or call it directly:
fs <- awe_select_features(mtcars, target = "mpg", top_n = 5)
fs
#> AWE Feature Selection
#> Selected 5 predictor(s): wt, disp, hp, drat, vs
#> Dropped (correlated): cyl
#> Univariate scores:
#> variable score
#> wt 0.8676594
#> disp 0.8475514
#> hp 0.7761684
#> drat 0.6811719
#> vs 0.6640389
#> am 0.5998324
#> carb 0.5509251
#> gear 0.4802848
#> qsec 0.4186840
plot_feature_selection(fs)awe_model() tries every candidate learner appropriate to
the target type and keeps the best by cross-validated score – similar to
caret::train(), but the whole pre/post pipeline is
included. Base learners (lm/glm,
rpart, and a dependency-free k-NN) always run;
randomForest, ranger, nnet,
e1071 (SVM, naive Bayes), kernlab (SVM),
glmnet (ridge/lasso/elastic net/regularized logistic),
gbm, class (k-NN classification),
MASS (LDA/QDA/robust regression), earth
(MARS), pls (partial least squares), and
xgboost are added automatically when installed:
mo <- awe_model(mtcars, target = "mpg", k = 3, seed = 1)
mo$leaderboard
#> model metric mean_score sd_score
#> 1 gradient_boosting RMSE 2.478830 0.6927698
#> 2 random_forest RMSE 2.628737 0.6141765
#> 3 ranger RMSE 2.629710 0.6448855
#> 4 ridge_regression RMSE 2.714844 0.6420909
#> 5 elastic_net RMSE 2.874028 0.8149560
#> 6 lasso_regression RMSE 2.909928 0.7816996
#> 7 mars RMSE 3.208627 0.3642917
#> 8 svm_linear RMSE 3.282273 0.5340148
#> 9 pls_regression RMSE 3.308410 0.9812047
#> 10 linear_regression RMSE 3.308660 0.9780443
#> 11 svm_radial RMSE 3.382489 0.9416822
#> 12 knn_regression RMSE 3.464304 0.7786841
#> 13 robust_regression RMSE 3.570143 0.8127930
#> 14 decision_tree RMSE 4.911884 1.0949792Restrict the candidate set with models = c(...) if you
only want to compare specific engines.
wr <- awe_wrap(mo)
vi <- varImp(wr)
vi
#> Variable importance:
#> variable importance
#> wt 2.18902157
#> hp 1.38503046
#> disp 1.31695965
#> drat 0.41168225
#> qsec 0.35432779
#> cyl 0.28095093
#> gear 0.01449258
#> vs 0.00000000
#> am 0.00000000
#> carb 0.00000000
plot(vi)plot(fit, type = "leaderboard") and
plot(fit, type = "tree") provide the same views directly
from a full awe() result.
awe_registry() shows every candidate
awe_model() would try for a given target type, and whether
it returns class probabilities (used by plot_roc()):
awe_registry("binary")
#> model has_probabilities
#> logistic_or_multinomial logistic_or_multinomial TRUE
#> decision_tree decision_tree TRUE
#> lda lda TRUE
#> qda qda TRUE
#> regularized_logistic regularized_logistic TRUE
#> random_forest random_forest TRUE
#> ranger ranger FALSE
#> ranger_prob ranger_prob TRUE
#> neural_net neural_net FALSE
#> svm_radial svm_radial TRUE
#> svm_linear svm_linear FALSE
#> naive_bayes naive_bayes TRUE
#> svm_kernlab svm_kernlab TRUE
#> knn knn FALSE
#> gradient_boosting gradient_boosting TRUEawe_ensemble() combines the best few cross-validated
candidates into a single performance-weighted ensemble – a weighted
average for regression, a weighted vote for classification – and returns
an ordinary AWEWrapper, so it works with
predict(), awe_evaluate(),
awe_explain(), and varImp() exactly like any
single fitted model:
awe_tune() runs a small, dependency-free grid search
with cross-validation for a handful of model families
(decision_tree, random_forest,
glmnet, svm_radial), returning the full grid
of scores, the best parameters, and a ready-to-use
AWEWrapper fit with them:
awe_compare() stacks the leaderboards of several
awe_model()/awe() runs – for example, before
and after feature selection – into one table, with a grouped-bar
plot() method:
mo_fs <- awe_model(awe_select_features(mtcars, target = "mpg", top_n = 5)$data,
target = "mpg", k = 3, seed = 1)
cmp <- awe_compare(all_predictors = mo, top5 = mo_fs)
cmp
#> AWE Comparison across 2 run(s): all_predictors, top5
#> model metric mean_score sd_score run
#> gradient_boosting RMSE 2.478830 0.6927698 all_predictors
#> random_forest RMSE 2.628737 0.6141765 all_predictors
#> ranger RMSE 2.629710 0.6448855 all_predictors
#> ridge_regression RMSE 2.714844 0.6420909 all_predictors
#> elastic_net RMSE 2.874028 0.8149560 all_predictors
#> lasso_regression RMSE 2.909928 0.7816996 all_predictors
#> mars RMSE 3.208627 0.3642917 all_predictors
#> svm_linear RMSE 3.282273 0.5340148 all_predictors
#> pls_regression RMSE 3.308410 0.9812047 all_predictors
#> linear_regression RMSE 3.308660 0.9780443 all_predictors
#> svm_radial RMSE 3.382489 0.9416822 all_predictors
#> knn_regression RMSE 3.464304 0.7786841 all_predictors
#> robust_regression RMSE 3.570143 0.8127930 all_predictors
#> decision_tree RMSE 4.911884 1.0949792 all_predictors
#> gradient_boosting RMSE 2.504072 0.3141047 top5
#> ranger RMSE 2.618305 0.5782509 top5
#> mars RMSE 2.775061 0.7315884 top5
#> robust_regression RMSE 2.805384 0.9809035 top5
#> knn_regression RMSE 2.848754 1.0722172 top5
#> random_forest RMSE 2.854309 0.6923072 top5
#> ridge_regression RMSE 2.854606 0.7451675 top5
#> lasso_regression RMSE 2.860643 0.8965948 top5
#> svm_linear RMSE 2.862427 1.0235029 top5
#> elastic_net RMSE 2.873602 0.8347105 top5
#> pls_regression RMSE 2.950528 0.8191091 top5
#> linear_regression RMSE 2.950528 0.8191091 top5
#> svm_radial RMSE 3.032948 0.7547546 top5
#> decision_tree RMSE 4.911884 1.0949792 top5
plot(cmp)For binary targets, plot_roc() draws an ROC curve with a
rank-based AUC; for any classification target,
plot_confusion() draws a confusion-matrix heatmap from an
AWEEvaluation:
iris2 <- iris[iris$Species != "setosa", ]
iris2$Species <- droplevels(iris2$Species)
mo2 <- awe_model(iris2, target = "Species", k = 3, seed = 1)
wr2 <- awe_wrap(mo2)
plot_roc(wr2)plot_residuals() gives the familiar residuals-vs-fitted
and normal Q-Q pair for continuous targets:
Every plotting function in the package shares the same palette and
ggplot2 theme, both exported for reuse in your own
plots:
The novelty in awe is not new machine-learning algorithms – it is a single, dependable workflow: automatic statistical reasoning based on variable types, a uniform model-wrapping interface, explainability by default, and communication-first outputs, all reproducible from one call.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.