Skip to content

16/ One registry of classifiers and feature selection methods (no change to results) - #142

Draft
ellispatrick wants to merge 1 commit into
review/15-defaults-depsfrom
review/16-registry
Draft

ellispatrick wants to merge 1 commit into
review/15-defaults-depsfrom
review/16-registry

Conversation

@ellispatrick

@ellispatrick ellispatrick commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Part 16 (#140 → #141 → this → #143). Based on #141.

Summary

No change to results. Every classifier and feature selection method now has one entry in a registry, R/registry.R. Adding a method takes:

  • one interface file;
  • its Collate line;
  • one registry entry.

It used to touch up to nine places.

Why

Ellis Patrick's decision on Q36 ("Yes"), ProjectClassifyR docs/DECISIONS.md, 10 October 2026, following docs/MAINTAINABILITY.md section 6. Before this, adding a classifier meant editing:

  • the interface file and Collate;
  • in constants.R: functionsTable and classifyKeywords;
  • in utilities.R: .classifierKeywordToParams;
  • simpleParams.R, for a *params() function and its tuning presets;
  • cleanClassifier's hard-coded penalised-GLM list;
  • two vignette tables.

Nothing recorded whether a method accepts classes, survival or both.

What changes

  • R/registry.R: .registerClassifier() and .registerSelection() entries, built in .onLoad, so file order doesn't matter. Each entry gives:
    • the functions;
    • the display name;
    • the description;
    • the outcomes it accepts;
    • tuning presets and default parameters;
    • the fallback classifier for too few features (the penalised GLMs fall back to GLM).
  • Read from the registry:
    • available()'s tables;
    • the keyword-to-function and keyword-to-parameters mappings;
    • the names shown in results and plots;
    • the too-few-features fallback.
  • Removed:
    • simpleParams.R;
    • the keyword and display-name tables in constants.R.
  • available() gains an Outcomes column (classes, survival or both).
  • crossValidate stops at once with a clear error when a classifier or selection method doesn't accept the outcome, e.g. "CoxPH can't be used with classes". Before, every cross-validation failed and the error was reported afterwards.
  • R/interfaceTemplate.R states the interface contract (arguments, prediction formats, feature extractors). The developer vignettes describe adding a method with a registry entry.
  • test-registry.R fits and predicts every registered keyword for each outcome it accepts, and checks the prediction format. A new method is tested by adding its entry.

Evidence

🤖 Generated with Claude Code

https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4

…to results)

- R/registry.R holds one entry per classifier and selection keyword: its functions, display name, description,
  the outcomes it accepts (classes, survival or both), tuning presets, default parameters and the fallback when an
  assay has too few features. It is built when the package loads.
- The keyword tables of available(), the keyword-to-function and keyword-to-parameters mappings, the display names
  of results and plots and the penalised GLM's fallback to an ordinary GLM are read from it. simpleParams.R and
  the tables in constants.R are removed.
- available() gains an Outcomes column. crossValidate stops early with a clear error when a classifier or selection
  method does not accept the kind of outcome, instead of every cross-validation failing.
- R/interfaceTemplate.R states the contract of training, prediction, feature and ranking functions. The developer
  vignettes describe adding a method with one registry entry.
- A test fits and predicts every registered keyword for each outcome it accepts and checks the prediction format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfsjwkbDbHkX4kJZNe4ER4

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant