tableBestModels: Generate a Summary Table of Best Models

View source: R/terga1.lib.R

tableBestModelsR Documentation

Generate a Summary Table of Best Models

Description

This function creates a data frame summarizing the best models from a list, displaying model names, AUC scores, and model gene sets.

Usage

tableBestModels(model.sim)

Arguments

model.sim

A list of models, where each model is represented by a sublist containing elements with names that include '"score"' for the model's AUC score and '"model"' for the selected features.

Details

The function iterates through the provided models, extracting and formatting the AUC score and sorted feature list for each. The resulting table includes: - **N**: Model identifier (e.g., "N1" for the first model). - **AUC**: The AUC score for the model. - **MGS**: The model gene set, showing selected features in sorted order.

**Structure**: - The function processes up to 20 models, or the number of available models if fewer than 20. - For each model, it retrieves the AUC score (by searching for '"score"' in the model name) and the model gene set (by searching for '"model"').

Value

A data frame with columns: - 'N': Identifier for each model (e.g., "N1", "N2"). - 'AUC': The AUC score for each model, rounded to 4 decimal places. - 'MGS': A string representing the sorted model gene set for each model.

Examples

## Not run: 
model.sim <- list(
  model_N1 = list(score = 0.85, model = c("geneA", "geneB", "geneC")),
  model_N2 = list(score = 0.90, model = c("geneC", "geneD", "geneE"))
)
best_models_table <- tableBestModels(model.sim)
print(best_models_table)

## End(Not run)


predomics/predomicspkg documentation built on Dec. 11, 2024, 11:06 a.m.