register_model_pro: Register a Prognostic Model Function

View source: R/prognosis.R

register_model_proR Documentation

Register a Prognostic Model Function

Description

Registers a user-defined or pre-defined prognostic model function with the internal model registry. This allows the function to be called later by its registered name, facilitating a modular model management system.

Usage

register_model_pro(name, func)

Arguments

name

A character string, the unique name to register the model under.

func

A function, the R function implementing the prognostic model. This function should typically accept X (features) and y_surv (survival object) as its first two arguments.

Value

NULL. The function registers the model function invisibly.

See Also

get_registered_models_pro, initialize_modeling_system_pro

Examples

# Example of a dummy model function for registration
my_dummy_cox_model <- function(X, y_surv, tune = FALSE) {
  # A minimal survival model for demonstration
  model_fit <- survival::coxph(y_surv ~ ., data = X)
  structure(list(finalModel = model_fit, X_train_cols = colnames(X),
                 model_type = "survival_dummy_cox"), class = "train")
}

# Register the dummy model
initialize_modeling_system_pro() # Ensure system is initialized
register_model_pro("dummy_cox", my_dummy_cox_model)
"dummy_cox" %in% names(get_registered_models_pro()) # Check if registered

E2E documentation built on Aug. 27, 2025, 1:09 a.m.