Package index
The modelblueprint object
Create, predict from, persist, and manipulate a modelblueprint. A modelblueprint wraps a fitted model together with its training data, pipeline functions, and deployment metadata.
-
modelblueprint - modelblueprint: a model-agnostic container for ML model lifecycles
-
predict(<modelblueprint>) - Generate predictions from a modelblueprint
-
savemb()saveMB() - Save a modelblueprint to disk
-
loadmb()loadMB() - Load a modelblueprint from disk
Accessors and updaters
Tidy extract_* and set_* verbs for reading and replacing individual slots. Each set_* returns a new modelblueprint — never mutates in place — and runs the S7 validator automatically.
-
extract_fit() - Extract the fitted model from a modelblueprint
-
extract_train()extract_test()extract_holdout() - Extract a data split from a modelblueprint
-
extract_pre_process_fun()extract_feat_eng_fun()extract_post_process_fun() - Extract pipeline functions from a modelblueprint
-
extract_original_inputs()extract_feature_names() - Extract feature name vectors from a modelblueprint
-
extract_target()extract_yhat_name()extract_exposure_name()extract_exposure_value()extract_exposure_zero_rep()extract_offset_name()extract_offset_value()extract_display_name()extract_deploy_notes() - Extract scalar metadata from a modelblueprint
-
set_model() - Swap the fitted model inside a modelblueprint
-
set_train()set_test()set_holdout() - Replace a data split in a modelblueprint
-
set_pre_process_fun()set_feat_eng_fun()set_post_process_fun() - Replace pipeline functions in a modelblueprint
-
set_original_inputs()set_feature_names() - Replace feature name vectors in a modelblueprint
-
set_target()set_yhat_name()set_exposure_name()set_exposure_value()set_exposure_zero_rep()set_offset_name()set_offset_value()set_display_name()set_deploy_notes() - Set scalar metadata on a modelblueprint
Data manipulation
dplyr-style verbs that operate on all data splits inside a modelblueprint simultaneously, returning a new modelblueprint.
-
filter(<modelblueprint>) - Filter rows in a modelblueprint's datasets
-
mutate(<modelblueprint>) - Mutate columns in a modelblueprint's datasets
-
left_join(<modelblueprint>) - Left-join into a modelblueprint's datasets
Model sequences
Chain multiple modelblueprints into a sequential pipeline where the output of one model feeds the input of the next.
-
mb_seq() - A sequential pipeline of model layers
-
mb_layer() - Construct a single layer for use in an
mb_seq() -
predict(<mb_seq>) - Generate predictions from an mb_seq
Validation and diagnostics
Quantify model performance and calibration. All functions accept either a modelblueprint (uses the stored data and model) or a plain data frame (bring your own predictions).
-
gain() - Cumulative Gains Chart
-
gain(<default>) - Cumulative Gains Chart (default method)
-
pred_vs_obs() - Predicted vs Observed Calibration Plot
-
residuals_grouped() - Grouped Residuals vs Predicted Plot
Feature analysis
Understand how individual features relate to the target and drive model predictions.
-
one_way() - Create a one-way analysis plot
-
one_way(<modelblueprint>) - One-way analysis for a modelblueprint
-
distribution() - Plot the distribution of the target variable
-
distribution(<modelblueprint>) - Target distribution for a modelblueprint
-
pdp() - Partial dependence plot for any predict()-compatible model
-
pdp(<modelblueprint>) - Partial dependence plot for a modelblueprint
-
shap() - SHAP Feature Importance and Dependence Plots
-
shap(<modelblueprint>) - SHAP plots for a modelblueprint
-
sami() - SAMI Double Lift Chart
Batch validation
Generate and save a full suite of validation, one-way, PDP, stability, and SHAP plots for every dataset split in a single call.
-
model_validation() - Generate and save model validation plots
Dashboard
Interactive Shiny app that combines all diagnostics and feature analysis tools into a single four-tab interface.
-
mb_dashboard() - Launch an interactive dashboard for a modelblueprint
-
unitise() - unitise a numeric variable to the range 0 to 1
-
save_plots() - Save plots or HTML widgets to a single HTML file
Example modelblueprints
Ready-made modelblueprint objects for exploring the package without needing your own data. Includes regression, classification, Poisson frequency (car insurance), random forest, XGBoost, and H2O examples.
-
mb_lm_regression()mb_lm_classification()mb_glm_regression()mb_glm_binomial()mb_glm_poisson()mb_glm_poisson_freq()mb_rpart_regression()mb_rpart_classification()mb_rf_regression()mb_rf_classification()mb_xgb_regression()mb_xgb_classification()mb_h2o_regression()mb_h2o_classification()mb_h2o_glm_large() - Example modelblueprint objects