--- title: "Shiny workbench: launch, data and first model" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Shiny workbench: launch, data and first model} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ## Launch the Shiny graphical interface DDESONN includes an optional Shiny graphical user interface (GUI) for preparing data, training and evaluating models, using saved models and viewing research results. After installing DDESONN, install the app dependencies once and launch from an interactive R session: ```{r launch-workbench, eval=FALSE} install.packages(c("shiny", "callr")) # once, if needed shiny::runApp(system.file("shiny", "benchmark", package = "DDESONN", mustWork = TRUE)) ``` For new training, follow **Data → Features → Build & Train → Model / Results**. For an existing model, choose **Use a saved model**, load its workbench `.rds` bundle and a CSV, then select holdout evaluation or production prediction. Information icons explain the controls, and **Show full R code** provides the corresponding workflow script. Plots appear within these pages automatically. Stop the app with the RStudio Stop button or Ctrl+C in an R terminal. ## Current and historical experiments **Experiments** displays saved study results without starting training: - **Current: clean matched study** compares DDESONN and Keras with 100 seeds per condition (four conditions, 400 fits). Identical predictor inputs are kept together in the same partition. See the [clean matched benchmark vignette](clean-matched-100-seeds.html) for the graphs, results and study scope. - **Historical: overlapping inputs** pairs 1,000 standard-AdaGrad DDESONN runs with archived legacy DDESONN observations. Training/test inputs overlap; this is a descriptive historical comparison. Keras was not rerun for this view. ## Choose an example On **1. Data**, choose a **Packaged training example** to load it immediately. Use **Reload selected example** to restore it after an upload. Provide one labeled dataset. On Features, Shiny divides it into training, validation and test sets; no separate unlabeled file is required. Loading or downloading data does not train a model. The app reads files from the installed package, using `system.file("extdata", ..., package = "DDESONN")`. Iris and mtcars come from R's datasets package. These choices work offline; the GitHub source link is for browsing, not an automatic download fallback. | Example | Suggested task / target | Starting predictors | Important context | |---|---|---|---| | Iris | Multiclass / Species | Four numeric measurements | Small first example, 150 rows. | | mtcars | Regression / mpg | All columns except mpg | Small regression example, 32 rows. | | Heart failure | Binary / DEATH_EVENT | All 12 numeric predictors | Repeated inputs limit evaluation; see the research vignette. | | WMT prices | Regression / close | All columns except close | Packaged snapshot; ordered splitting is suggested. This same-row illustration is not a validated forecast. | | Customer labeled dataset | Multiclass / Segmentation | All columns except Segmentation | Review ID, categories and missing values before preparation. | The full original rows and columns remain available for inspection and download. All columns except the target start selected. Preprocessing choices are shown explicitly before preparation. Review identifiers and information derived from the answer. Auto proposes identifier exclusions, encoding and missing-value rules; inspect or override the plan before preparing. The raw dataset is retained unchanged. For WMT, review the nonnumeric date and answer-derived adjusted close. On Features, the dataset name confirms what is loaded. Both navigation paths show its target and predictor defaults; moving between tabs preserves your edits. ## A first iris model 1. Keep Iris on Data; inspect its preview. 2. On **2. Features**, use target **Species**, the four measurement predictors, and **Multiclass classification**. Review the split and click **Prepare data**. 3. On **3. Build & Train**, keep **Basic**, try hidden-layer sizes `8` and **Epochs per model fit** `2`, then click **Train new model**. 4. On **4. Model / Results**, inspect the evaluations and predictions. Results depend on settings and seed; this is a small workflow example, not a performance claim. For mtcars, load its example instead. The default target is mpg, task Regression, and predictors all other columns. For a smaller example, manually select only wt and hp on Features. **Show full R code** follows your actual prepared data and settings after preparation. ## Read the same data in R ```{r load-r-examples, eval=FALSE} data <- datasets::iris # Or use the regression example: data <- datasets::mtcars ``` ```{r load-package-csv, eval=FALSE} path <- system.file("extdata", "heart_failure_clinical_records.csv", package = "DDESONN") stopifnot(nzchar(path)) data <- read.csv(path, check.names = FALSE) ``` The app's generated recipes use the corresponding installed filename and record a SHA256 check for packaged CSVs, so changed data is detected when reproducing a recipe. Original packaged CSV downloads preserve their bytes. Iris/mtcars CSV exports contain the dataset columns; R row names are not exported as predictors. The existing data files are reused; no external datasets are added by this change. ## Predict using the unlabeled customer file Train a customer model first, or load your compatible saved workbench bundle. The customer preset selects all non-target columns. Auto proposes excluding ID, one-hot encoding the categories and handling missing predictor values. You can therefore prepare the full relevant customer attributes without reducing them to Age alone. The matching prediction file provides the same predictor columns. Choose **Use a saved model → Evaluate or predict**. Select labeled evaluation and include the known target answers to measure accuracy, or select unlabeled prediction and click **Run predictions** to obtain answers without accuracy. Alternatively, expand the optional packaged-customer section, choose **Use packaged customer rows**, and click the same **Run predictions** button. The chart and table appear below the CSV; downloading predictions is optional. These demonstration rows may match inputs in the saved splits; the result reports those matches. These rows have no Segmentation labels; they are not needed for the training, validation or test split. No pretrained model is bundled or automatically loaded. The saved raw predictor names and types must match; fitted encoding, missing-value rules and scaling are reused; incompatible data produces an error rather than changing the trained model. For older numeric-only bundles, prediction inputs must still be complete numeric values in the original schema. Loading another dataset clears preparation for a new model while preserving completed models. A raw file without target labels is not automatically assigned a fake target. The original CSV upload and prediction-upload paths remain available. ## Seeds, evaluation and related guides A seed value of 42 is not 42 runs. Basic uses the Features seed for one run. Custom's training seed list repeats complete training runs on the same prepared split: `42,43` with Single model and 100 epochs means two 100-epoch runs, 200 total. Binary preparation groups identical selected predictor inputs and checks for overlap again after preprocessing. Ordered binary splitting rejects boundaries that separate identical inputs. Other task types use their configured random or ordered split without this binary grouping safeguard. Review related subjects, identifiers and leakage separately; these checks do not establish generalization to other datasets. The app's contextual links take you to **Vignettes** for this guide, the standard-AdaGrad research record, single-run/ensemble plot controls and ensemble logs. Installed HTML guides open locally when present; otherwise the links open their online source. All guide navigation preserves your current session. ## Browse and profile the loaded data The inspector follows the selected example or uploaded CSV. Choose first rows (`head`), last rows (`tail`) or a starting row number, and show 1–100 rows at a time. Choose visible columns to inspect wide files. The row count identifies the subset and the full dataset size; the displayed R code reproduces that view. These controls do not execute arbitrary R scripts or alter training inputs. Open **Descriptive summary — full dataset** for types, distinct counts, missing values and numeric means, standard deviations and quartiles across all rows. Blank text counts as missing; infinite values are counted separately. Numeric summaries and plots use finite values only, without cleaning the underlying data. Open **Box-and-whisker plot** and choose a numeric column to explore its median, spread and potential outliers. Columns use separate plots because units differ. ## Auto and Manual preprocessing On Features, **Auto** suggests a complete plan using local, reproducible rules; it does not call an AI service. Each section can follow the overall mode or use an explicit choice. **Manual** starts with complete numeric inputs and asks you to choose any required treatment. Standardization is independently controlled by the existing training-means/SDs switch in either mode. | Step | Auto | Other choices | |---|---|---| | Numeric missing/nonfinite values | Training median | Training mean, zero, or reject missing values | | Unordered categories | One-hot encoding | Explicit ordinal order, or require numeric predictors | | Missing categories | Separate Missing level | Most frequent training category, or reject missing values | | Identifier-like names | Exclude ID, names ending `_id` or starting `id_` | Keep selected columns, or override a single column | One-hot encoding gives categories separate 0/1 inputs without imposing an order. For ordinal encoding, use **Override one column**, choose Ordinal, and enter an explicit low-to-high order such as `Low|Average|High`. All training categories must appear exactly once. Known levels become 1..K; missing uses 0 and unseen uses -1. Choose ordinal encoding only when the order has a real meaning. Click **Apply column override** to store it, or **Clear all column overrides** to follow section rules again. The status lists overridden columns. Loading a new dataset clears column overrides; merely moving between tabs preserves them. The proposed table shows each selected column's type, role, encoding, missing rule and reason. Identifier-name exclusions are suggestions, not proof of irrelevance; review them and possible leakage. The Segmentation target keeps its A/B/C/D labels and is never imputed. Missing target values cause an error. Click Prepare data to split first, then fit category levels, replacement values and standardization using **training rows only**. The fitted-rule disclosure shows actual training replacements and category lists. No rows are removed. Save the workbench bundle to retain the complete rules, output-column order, model and training state. Validation, test and new prediction data reuse those rules without recalculating medians, modes, levels or scaling. A new one-hot category maps to a reserved Unknown input; missing categories have a separate reserved input. Unknown inputs have no learned examples if none existed during training, so predictions on new categories require care. Blank text counts as missing; categorical whitespace is trimmed. Numeric infinities are treated as missing. Entirely missing numeric training columns need explicit zero filling or exclusion. A mode cannot be learned from an entirely missing category; choose a Missing level instead. Columns with more than 200 observed training categories, or a design exceeding 2,000 inputs, require explicit simplification. Dates and free text can require manual conversion/exclusion; for the WMT illustration review the date column and answer-derived adjusted close. Auto does not identify every leakage risk. The preprocessing code preview records your choices. After preparation, the full R code contains portable fitting and application functions and uses the same split. All learned preprocessing precedes native Basic or Custom training; the new preprocessing path disables additional internal input normalization. Older numeric-only saved bundles remain supported without changing their rules. ## Read the defaults and training curves A dropdown entry such as **Use Auto default: training median** means that this step takes its treatment from Overall preprocessing. If you select Manual, the inherited label changes to **Use Manual default: require complete**. Selecting an explicit method such as Training mean overrides the overall choice and stays selected when you switch modes. Per-column inheritance names the relevant step above it. Click the info icon beside any preprocessing control to see what all its options mean, plus a focused R example. Apply column override stores edits; selecting a column alone does not apply them. Custom runs may log multiple members, training seeds and MAIN/TEMP fits. A fresh fit can start at a different loss, producing a sawtooth if those curves are joined. The workbench now leaves fits unconnected, adds boundaries and labels, and reports the local epoch on hover. Fit numbers follow log order; they do not identify a specific seed, member or MAIN/TEMP role. Older Custom bundles lacking fit metadata can infer boundaries from their configured epoch budget; the chart explanation identifies this inference. Training loss is not held-out performance or proof of a model-quality problem by itself. Use Download PNG or SVG to save the chart, or Download loss data for the plotted records including fit/local-epoch columns. Copy chart image puts the visible chart bitmap on the clipboard in supported browsers. If browser permissions or the RStudio viewer prevent image copying, use the PNG/SVG downloads instead. ## Keep recent work and share what you built Recent runs keeps completed models and CSV results in this browser session only. Clearing the saved-model workspace preserves this archive; removing history does not clear active work or training. Restore a model and download its `.rds` to keep it permanently. Restoring a recent CSV run restores its recorded results rather than starting another fit. Please share your applications, achievements or suggestions with the author. See the [community and next-steps guide](https://github.com/MatHatter/DDESONN/blob/main/vignettes/community-and-next-steps.Rmd), or [connect on LinkedIn](https://www.linkedin.com/in/mathewfok).