scib_rapids.utils.principal_component_regression#
- scib_rapids.utils.principal_component_regression(X, covariate, categorical=False, n_components=None)[source]#
Principal component regression (PCR) using CuPy.
- Parameters:
X (
ndarray|ndarray) – Array of shape (n_cells, n_features).covariate (
ndarray|ndarray) – Array of shape (n_cells,) or (n_cells, 1) representing batch/covariate values.categorical (
bool(default:False)) – If True, batch will be treated as categorical and one-hot encoded.n_components (
int|None(default:None)) – Number of components to compute. If None, all components are used.
- Return type:
- Returns:
pcr: float