scdynomics.ft_clf_predict
- scdynomics.ft_clf_predict(clf_adata: anndata.AnnData = None, clf_adata_path: str = None, mod1_layer: str = None, mod2_layer: str = None, obs_label: str = None, label_dict_path: str = None, token_dict_path: str = '../data/gene_dict/token_dict.json.gz', base_model_ckpt: str = None, tuned_model_ckpt: str = None, outpath: str = None, accelerator: str = 'cpu', seed: int = 42, **kwargs) tuple
Predict the labels of the data using the fine-tuned classifier.
- Parameters:
- clf_adata:
ad.AnnData(default:None) The loaded AnnData object to run predictions on.
- clf_adata_path:
str(default:None) The path to the AnnData file. Must provide either this or
clf_adata.- mod1_layer:
str(default:None) The layer specifying the first modality to use for prediction.
- mod2_layer:
str(default:None) The layer specifying the second modality to use for prediction.
- obs_label:
str(default:None) The key in
adata.obscontaining the true labels (used only to generate a classification report).- label_dict_path:
str(default:None) Path to the JSON dictionary mapping text labels to integer classes. Required if
obs_labelis provided.- token_dict_path:
str(default:"../data/gene_dict/token_dict.json.gz") Path to the token dictionary file.
- base_model_ckpt:
str(default:None) Path to the base pretrained foundation model checkpoint.
- tuned_model_ckpt:
str(default:None) Path to the fine-tuned classifier checkpoint.
- outpath:
str(default:None) File path to save the resulting predictions (and classification report).
- accelerator:
str(default:"cpu") The accelerator to be used for training. It can be “auto”, “cuda”, “mps”, or “cpu”.
- seed:
int(default:42) The random seed for reproducibility.
- kwargs:
dict Additional keyword arguments.
- clf_adata:
- Returns:
tuple - all_preds:
dict A dictionary mapping cell IDs to their predicted class probabilities.
- report:
dictorNone The sklearn classification report dictionary (if
obs_labelandlabel_dict_pathwere provided).
- all_preds: