scdef.from_reference ¶
from_reference(reference_model: 'scDEF', adata: AnnData, counts_layer: Optional[str] = None, batch_key: Optional[str] = None, reference_obs: Optional[str] = None, query_obs: Optional[str] = None, copy_cell_z: bool = True, init_gene_scale: Union[str, ndarray] = 'batch', **kwargs: Any) -> 'scDEF'
Create a new model initialized from a fitted reference hierarchy.
The new model uses adata as its data matrix and initializes global
hierarchy parameters (W, BRD/ARD, alpha-related hyperparameters) from
reference_model. Cell/gene budgets are initialized from the new data
so modality/batch-specific scales can be learned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference_model
|
'scDEF'
|
a fitted |
required |
adata
|
AnnData
|
AnnData for the new model. |
required |
counts_layer
|
Optional[str]
|
counts layer key in |
None
|
batch_key
|
Optional[str]
|
batch annotation column in |
None
|
reference_obs
|
Optional[str]
|
reference batch label (for gene-scale init). |
None
|
query_obs
|
Optional[str]
|
query batch label (for gene-scale init). |
None
|
copy_cell_z
|
bool
|
copy per-cell z warm starts for shared cells. |
True
|
init_gene_scale
|
Union[str, ndarray]
|
how to initialize per-batch
|
'batch'
|
**kwargs
|
Any
|
additional keyword arguments forwarded to the model constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
'scDEF'
|
A new (unfitted) |