scxpand.lightgbm.run_lightgbm_#
Functions
Compute balanced sample weights. |
|
|
Run inference using a trained LightGBM model. |
|
Train a LightGBM model for gene expression classification. |
- scxpand.lightgbm.run_lightgbm_.compute_sample_weights(y)#
Compute balanced sample weights.
- Return type:
- scxpand.lightgbm.run_lightgbm_.run_lightgbm_inference(model, data_format, adata=None, data_path=None, eval_row_inds=None)#
Run inference using a trained LightGBM model.
- Parameters:
model (
BaseEstimator) – Trained LightGBM modeldata_format (
DataFormat) – Data format specification for preprocessingadata (
AnnData|None(default:None)) – AnnData object containing gene expression data (alternative to data_path)data_path (
str|Path|None(default:None)) – Path to data file (alternative to adata)eval_row_inds (
ndarray|None(default:None)) – Indices of rows to evaluate (if None, uses all rows)
- Return type:
- Returns:
Array of prediction probabilities for the positive class
- scxpand.lightgbm.run_lightgbm_.run_lightgbm_training(base_save_dir, prm, data_path, dev_ratio=0.2, trial=None, score_metric='harmonic_avg/AUROC', resume=False)#
Train a LightGBM model for gene expression classification.
- Parameters:
base_save_dir (
str|Path) – Directory to save model and resultsprm (
LightGBMParams) – LightGBM parametersdata_path (
str) – Path to data filedev_ratio (
float(default:0.2)) – Ratio of data to use for validationtrial (
Trial|None(default:None)) – Optuna trial object for hyperparameter optimizationscore_metric (
str(default:'harmonic_avg/AUROC')) – Metric to use for scoringresume (
bool(default:False)) – Whether to resume from existing checkpoint (not implemented for LightGBM)
- Return type:
- Returns:
Dictionary containing evaluation results