View source: R/predict_values.R
| preprocess | R Documentation |
Pre-process Coh-Metrix and ReaderBench data files before applying predictive models. Uses the artifact registry to load the correct variable lists and applies centering and scaling per sub-model, preserving the original behavior by model key.
preprocess(model, data)
model |
Character scalar. Which scoring model to use. Supported values include: ReaderBench: 'rb_mod1','rb_mod2','rb_mod3narr','rb_mod3exp','rb_mod3per','rb_mod3all', 'rb_mod3narr_v2','rb_mod3exp_v2','rb_mod3per_v2','rb_mod3all_v2'; Coh-Metrix: 'coh_mod1','coh_mod2','coh_mod3narr','coh_mod3exp','coh_mod3per','coh_mod3all'; GAMET: 'gamet_cws1'. Legacy keys for RB mod3 (non-v2) are mapped to their v2 equivalents internally. |
data |
A data.frame produced by |
Models 2 and 3 center and scale features using the data supplied in this call. Changing the scoring group can change a text's score. A single row or features with no variation can produce missing values. Model 1 and GAMET pass the input through to their saved models without this additional scaling.
The 'example' model is for demonstrating the workflow only. Its preprocessing
needs no downloads; prediction requires wa_seed_example_models() first.
A list of pre-processed data frames, one per sub-model. For models with no
varlists (e.g., 'rb_mod1','coh_mod1'), returns six copies of the input data.
For 'gamet_cws1', returns two copies (CWS/CIWS). For 1-part/3-part models, returns
a list of length 1/3 with centered & scaled features plus the ID column.
# Minimal, offline example using the built-in 'example' model (no downloads)
rb_path <- system.file("extdata", "sample_rb.csv", package = "writeAlizer")
rb <- import_rb(rb_path)
pp <- preprocess("example", rb)
length(pp); lapply(pp, nrow)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.