Schema-Driven Machine Learning and Visualization
Overview
Machine learning and visualization package with an 'S7' backend featuring comprehensive type checking and validation, observable runs, and auditable outputs. The functional API provides one-call access to supervised and unsupervised learning through train(), cluster(), and decomp(). All configuration steps are performed using setup functions and validated. A single call to train() can handle preprocessing, decomposition, hyperparameter tuning, model stacking, and testing with nested resampling. Supports 'data.frame', 'data.table', and 'tibble' inputs and parallel execution. Plot methods for trained and resampled supervised models draw interactive figures through 'rtemis.draw'. Includes native implementations of SuperLearner, RuleFit, and Linear Additive Trees, and supports conformal prediction. The package first appeared in E.D. Gennatas (2017) https://repository.upenn.edu/entities/publication/d81892ea-3087-4b71-a6f5-739c58626d64.
- The standalone Plotly, networkD3, threejs and leaflet
draw_*()functions move to the 'rtemis.dplot' package on r-universe, with their themes (theme_*(),choose_theme(),available_themes()), palettes (get_palette()), color utilities (col2grayscale(),color_adjust(),previewcolor()),available_draw(),uniprot_get(),xtdescribe(), thext_exampledata and thertemis_theme,rtemis_paletteandrtemis_fontoptions. 'rtemis.draw' provides their replacements. rtemis keepsdraw_linad(), which takes an 'rtemis.draw'Theme, androc_curve(). setup_PCoA()configures principal coordinates analysis (classical multidimensional scaling) on a choice of dissimilarities; it applies to new data through Gower's out-of-sample formula, so it can betrain()'s decomposition step, and does not reconstruct the input.setup_MDS()configures metric or nonmetric multidimensional scaling through 'vegan' with multiple starts; it cannot be applied to new data and does not reconstruct the input.review()assesses a trained supervised model, single-split or resampled: it reports sample sizes, every training and test metric, and comparisons with a baseline predictor, with confidence intervals and tests for a single split and a description of the variation between resamples for a resampled model, then notes small samples, many predictors, and signs of overfitting.ai_review()asks a language model, through 'rtemis.llm', to write a summary, evaluation, next steps and caveats from areview(), statements citing the review's finding codes, checked against the review; the result keeps the review and records the model, settings, prompt and a hash of the review.- A fitted model records the value its backend chose for a hyperparameter left unset, so the model and its record state every value the fit used: for example
mtryfor ranger,nkfor MARS, the loss and optimizer settings for MLP, and the engine settings for LINAD. - LightRuleFit stops with a corrective error when its boosting stage makes no split.
setup_TabNet()rejectsimportance_sample_sizewhenskip_importanceis TRUE.setup_CART(cost =)andsetup_Ranger(class_weights =)reach their backends; class weights named by class are matched to the outcome's levels.setup_Ranger()dropscase_weights, which ranger did not receive; per-case weights are passed withtrain(weights =).setup_GLMNET()dropsoffset, which failed at prediction and under resampling.setup_LINAD()andsetup_LINADForest()takeroot_forward_stopandroot_node_test, the root model's stopping rule and slopes test; unset uses the node-level value.
Show all changes in 1.4.2Hide the rest of the changes in 1.4.2
- Variable importance (
get_varimp()) holds one measure per name, each stating what it quantifies (split gain, permutation, coefficient, ...), the cases it was computed on, whether it is signed or depends on predictor units, how it ranks predictors, and a description for the fitted model; the measures replace the single table in@data, andvarimp_table()combines them into one data.frame.plot_varimp()ranks bars by the measure's direction (a cross-validated risk smallest first). Linear SVM weights are oriented toward the positive class, and a forest fitted withimportance = "none"has no importance. writeup()writes the Methods and Results sections for a trained supervised model from the model and itsreview(), every number traceable to the field it was read from, with references to R, rtemis, the fitting packages and the statistical methods, a main hyperparameter table (primary hyperparameters and every one tuned, specified or resolved during fitting;include_hyperparametersreplaces the primary list) and a supplementary table of every hyperparameter with its value, how it was chosen and the values tried, and a list of what the model does not record.write_text()writes awriteup(),review()orai_review()as Markdown.- Stratified resampling (
setup_KFold(),setup_StratSub(),setup_StratBoot()) stratifies a categorical variable by its levels; with more than four levels it grouped adjacent levels together. - Metric labels print AUC, PPV and NPV in capitals.
- LightRF predictions are no longer pulled toward 0 when some trees cannot split, as happens on small samples: such trees now predict their sample's center. Training reports how many trees could not split.
setup_SuperConfig()andsetup_SuperConfigLive()reject a decomposition that cannot be applied to new data, as reading a supervised config already did.- Shared results identify implementation-specific learner, execution, preprocessing, and resampler configs by schema and read their typed settings without inserting omitted defaults.
write_config()andwrite_record()write numbers with 15 significant digits instead of rounding to four decimal places.calibrate()takesexecution_config; calibration models train serially when it is unset.train()and thesetup_*()functions spend less time reading property declarations and default policies; a single CART fit oniristakes about a third of the time.- Each parallel task receives only its own resample or bag; LINADForest and
bias_variance()pass training data to local workers through shared memory. - GAM classification trains on a data.table, which failed for every outcome, and on a multiclass outcome, using mgcv's multinomial family. A multiclass GAM reports no variable importance or standard errors, and
explain()refuses its GAMTerms estimator;explanation_methods()reports GAM's exactness as dependent on the fit. - LinearSVM and RadialSVM probabilities are those of the positive class for a binary outcome and follow the outcome's level order for a multiclass one. Binary probabilities were those of the negative class when the first training case belonged to the positive class.
setup_GridSearch()withmaximizeunset maximizes every metric for which a higher value is better (accuracy, balanced accuracy, sensitivity, specificity, PPV, NPV, F1, AUC, RΒ², concordance) and minimizes the others; it minimized AUC, sensitivity, specificity, PPV, NPV and F1.se()is exported: standard errors of the fit for GLM, GAM, BART and LINADForest models.get_metrics()returns the metrics a supervised model, resampled model, clustering or decomposition stores for one sample;calibrated = TRUEselects a calibrated classifier's calibrated metrics.$and[[read the properties of resampled models, resampled metrics, tuners, LightRuleFit models andbias_variance()results, with tab completion, and[[reads any property of a decomposition, as$does. On these objects and on models and clusterings, a name that is not a property raises an error listing the properties.plot_varimp()draws aSHAPexplanation's mean absolute contributions.plot()draws a fitted supervised model's default view: true against predicted values for regression, confusion matrices for classification, and metric distributions for resampled models.present()prints the model's description and returns the same view;plot_roc()draws ROC curves.- Model plots color each data split the same way: training teal, validation purple, test magenta. Confusion matrices shade correct predictions blue and incorrect predictions orange.
- Imputation fitted on training data is applied to new data:
apply_preprocessor(), andtrain()on validation, test and resampled test data, impute with what was learned from the training data rather than from the new data. - Mean and mode imputation (
impute_type = "meanMode") stores the value imputed into every feature in the new config propertiesimpute_numeric_valuesandimpute_level_values. - Mean and mode imputation keeps each feature's type.
impute_numeric("mean" or "median") andimpute_categorical("mode") replaceimpute_discreteandimpute_continuous. Integer features take the mean or median rounded half to even, logical features their more frequent value (FALSE on a tie), and factor and character features their mode, a tie going to the first level or the first value in code point order. Integer features took their mode, a tie going to the value appearing last. A supplied value that a feature's type cannot hold is an error. - missRanger imputation keeps its fitted random forests in the
Preprocessor(@imputer) and applies them withpredict(); features with no missing training values take a mean or mode value on new data. Allimpute_missRanger_paramsreach missRanger, which received onlypmm.k. - micePMM imputation is available to
preprocess()only:setup_SupervisedPreprocessor()does not offer it, andapply_preprocessor()refuses a preprocessor that uses it. setup_SupervisedPreprocessor()imputes with mean and mode values by default (impute_type = "meanMode"); missRanger, fitted on every training set of atrain()run, is chosen explicitly. The Imputation sections ofsetup_SupervisedPreprocessor()andsetup_Preprocessor()describe each method's cost and limits.
Supervised result validation
- Outcomes, predictions, and classification probabilities must have matching row counts within each sample.
- Categorical outcomes and predictions must preserve the training class levels and their order; probability matrices require one column for binary classification or one per class for multiclass classification.
From NEWS.md in the release
Install
Health
ERRORtestsr-devel-windows-x86_64, r-release-linux-x86_64
r-devel-windows-x86_64
Running 'testthat.R' [146s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(rtemis)
.:rtemis 1.2.7 π x86_64-w64-mingw32/x64
> library(testthat)
Attaching package: 'testthat'
The following object is masked from 'package:rtemis':
describe
>
> test_check("rtemis")
Attaching package: 'data.table'
The following object is masked from 'package:base':
%notin%
2026-10-20 02:51:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-20 02:51:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-20 02:51:32 [0mUsing max n bins possible = 2.[0m [kfold]
2026-10-20 02:51:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-20 02:51:32 [0mUsing max n bins possible = 3.[0m [kfold]
2026-10-20 02:51:33 [0m[1;38;2;15;106;102mβ[0m Created file: D:\temp\2026_10_19_01_50_00_32085\RtmpemNOgv\rtemis_cluster.j
...[truncated]...
ds.[0m [train]
[ FAIL 1 | WARN 4 | SKIP 4 | PASS 356 ]
ββ Skipped tests (4) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ For local testing only; requires CSV file (3): 'test_ClusterConfig.R:19:3',
'test_DecomposeConfig.R:19:3', 'test_SuperConfig.R:48:3'
β’ empty test (1):
ββ Failed tests ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ Error ('test_Clustering.R:96:3'): cluster_DBSCAN() succeeds βββββββββββββββββ
Error: approx must be a single, finite, nonnegative number.
Backtrace:
β
1. ββrtemis::cluster(...) at test_Clustering.R:96:3
2. ββrtemis:::cluster_(config = config, x = x, verbosity = verbosity)
3. ββS7::S7_dispatch()
4. ββrtemis (local) `method(cluster_, rtemis::DBSCANConfig)`(...)
5. ββdbscan::dbscan(...)
6. ββdbscan:::.validate_nonnegative_scalar(extra$approx %||% 0, "approx")
[ FAIL 1 | WARN 4 | SKIP 4 | PASS 356 ]
Error:
! Test failures.
Execution haltedr-release-linux-x86_64
Running βtestthat.Rβ [107s/153s]
Running the tests in βtests/testthat.Rβ failed.
Complete output:
> library(rtemis)
.:rtemis 1.2.7 π x86_64-pc-linux-gnu
> library(testthat)
Attaching package: 'testthat'
The following object is masked from 'package:rtemis':
describe
>
> test_check("rtemis")
Attaching package: 'data.table'
The following object is masked from 'package:base':
%notin%
2026-10-17 23:06:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-17 23:06:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-17 23:06:32 [0mUsing max n bins possible = 2.[0m [kfold]
2026-10-17 23:06:32 [0mInput contains more than one column; stratifying on last.[0m [resample]
2026-10-17 23:06:32 [0mUsing max n bins possible = 3.[0m [kfold]
2026-10-17 23:06:32 [0m[1;38;2;15;106;102mβ[0m Created file: /home/hornik/tmp/scratch/RtmpG2RAo5/rtemis_cluster.json[0m
...[truncated]...
ds.[0m [train]
[ FAIL 1 | WARN 4 | SKIP 4 | PASS 356 ]
ββ Skipped tests (4) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ For local testing only; requires CSV file (3): 'test_ClusterConfig.R:19:3',
'test_DecomposeConfig.R:19:3', 'test_SuperConfig.R:48:3'
β’ empty test (1):
ββ Failed tests ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ Error ('test_Clustering.R:96:3'): cluster_DBSCAN() succeeds βββββββββββββββββ
Error: approx must be a single, finite, nonnegative number.
Backtrace:
β
1. ββrtemis::cluster(...) at test_Clustering.R:96:3
2. ββrtemis:::cluster_(config = config, x = x, verbosity = verbosity)
3. ββS7::S7_dispatch()
4. ββrtemis (local) `method(cluster_, rtemis::DBSCANConfig)`(...)
5. ββdbscan::dbscan(...)
6. ββdbscan:::.validate_nonnegative_scalar(extra$approx %||% 0, "approx")
[ FAIL 1 | WARN 4 | SKIP 4 | PASS 356 ]
Error:
! Test failures.
Execution halted- ERROR11 OK, 2 ERROR2026-10-05
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK7 OK2026-03-27
Documentation
- Help pages
- 222 (18 internal)includes a package overview page
- Examples that run
- 95%207 run in a plain check (10 of them under a condition) · 1 only when donttest examples are enabled (R CMD check --as-cran) · 10 never run
- Exported functions with examples
- 99%
- Documented parameters
- 99%
- Return-value docs
- 100%
- Help pages citing references
- 6%
Downloads
Repository
- PRs merged (all time)
- 98%
- Median days to close, 50 most recently updated closed issues
- 0
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
Commit identities over time
5 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/rtemis-org/rtemis on 2026-10-22.
The R CMD check workflow runs on Linux and Windows
GitHub Pages site last deployed 2025-06-04
Dependencies
Installing rtemis adds 40 packages (22 with compiled code, 33 MB of source tarballs). Heaviest: data.table 5.7 MB, bslib 5.6 MB, sass 2.9 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 1.4.2Latest2026-10-19 · current release · diff ↗ ·
removed 46 exports
available_draw, available_themes, choose_theme, col2grayscale, color_adjust, draw_3Dscatter, draw_bar, draw_box, draw_calibration, draw_confusion, draw_dist, draw_fit, draw_graphD3, draw_graphjs, draw_heatmap, draw_leaflet, draw_pie, draw_protein, draw_pvals, draw_roc, draw_scatter, draw_spectrogram, draw_survfit, draw_table, draw_ts, draw_varimp, draw_volcano, draw_xt, get_palette, preprocess.class_tabular.Preprocessor and 16 moreadded 112 exports
.drop_meta_keys, .get_alg_name, .get_clust_name, .get_decom_name, .list_to_ClusteringConfig, .list_to_PreprocessorConfig, .list_to_SuperConfig, .list_to_SupervisedPreprocessorConfig, .supervised_algorithms, HyperparameterCandidates, JSONSchema_to_S7, S7_dispatcher_JSONSchema, S7_to_JSONSchema, ai_review, applicable_metrics, apply_preprocessor, available_calibration, bias_variance, conformal, conformal_metrics, data_fingerprint, data_profile, decomp_metrics, decomposition_traits, draw_linad, explain, explanation_methods, fit_predict, fitted_config, get_learning_curve and 82 more - RR 4.6.0 released · 2026-04-24
- 1.2.72026-03-26 · diff ↗ ·
removed 3 exports
present.list, rtemis_colors, write_tomladded 15 exports
.list_to_DecompositionConfig, .list_to_Hyperparameters, .list_to_ResamplerConfig, .list_to_TunerConfig, apply_decomp, get_varimp, numeric_features, roc_curve, set_positive_class, setup_ClusterConfig, setup_DecomposeConfig, setup_SuperConfigLive, show_color_key, to_json, write_config - 1.0.02026-03-26
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-03-26
- Total releases
- 3 / 1 yrs
- License
- BSD_3_clause + file LICENSE OSI · relicensed from GPL (>= 3) in 1.4.2
- Minimum R
- ≥ 4.4.0
- Download size
- 2.1 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("rtemis")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.