cellrank.ul.models.SKLearnModel.prepare
- SKLearnModel.prepare(gene, lineage, backward=False, time_range=None, data_key='X', time_key='latent_time', use_raw=False, threshold=None, weight_threshold=(0.01, 0.01), filter_cells=None, n_test_points=200)
Prepare the model to be ready for fitting.
- Parameters
gene (
str
) – Gene inanndata.AnnData.var_names
.lineage (
Optional
[str
]) – Name of a lineage inanndata.AnnData.obsm
['{lineage_key}']
. If None, all weights will be set to 1.backward (
bool
) – Direction of the process.time_range (
Union
[float
,Tuple
[float
,float
],None
]) –Specify start and end times:
data_key (
Optional
[str
]) – Key inanndata.AnnData.layers
or ‘X’ foranndata.AnnData.X
. Ifuse_raw = True
, it’s always set to ‘X’.time_key (
str
) – Key inanndata.AnnData.obs
where the pseudotime is stored.use_raw (
bool
) – Whether to accessanndata.AnnData.raw
.threshold (
Optional
[float
]) – Consider only cells with weights >threshold
when estimating the test endpoint. If None, use the median of the weights.weight_threshold (
Union
[float
,Tuple
[float
,float
]]) – Set all weights belowweight_threshold
toweight_threshold
if afloat
, or to the second value, if atuple
.filter_cells (
Optional
[float
]) – Filter out all cells with expression values lower than this threshold.n_test_points (
int
) – Number of test points. If None, use the original points based onthreshold
.
- Return type
- Returns
Nothing, just updates the following fields:
x
- Filtered independent variables of shape (n_filtered_cells, 1) used for fitting.y
- Filtered dependent variables of shape (n_filtered_cells, 1) used for fitting.w
- Filtered weights of shape (n_filtered_cells,) used for fitting.x_all
- Unfiltered independent variables of shape (n_cells, 1).y_all
- Unfiltered dependent variables of shape (n_cells, 1).w_all
- Unfiltered weights of shape (n_cells,).x_test
- Independent variables of shape (n_samples, 1) used for prediction.prepared
- Whether the model is prepared for fitting.