cellrank.ul.models.GAM¶
-
class
cellrank.ul.models.
GAM
(adata, n_knots=6, spline_order=3, distribution='gamma', link='log', max_iter=2000, expectile=None, grid=None, spline_kwargs=mappingproxy({}), **kwargs)[source]¶ Fit Generalized Additive Models (GAMs) using
pygam
.- Parameters
adata¶ (
anndata.AnnData
) – Annotated data object.spline_order¶ (
int
) – Order of the splines, i.e. 3 for cubic splines.distribution¶ (
str
) – Name of the distribution. Available distributions can be found here.link¶ (
str
) – Name of the link function. Available link functions can be found here.max_iter¶ (
int
) – Maximum number of iterations for optimization.expectile¶ (
Optional
[float
]) – Expectile forpygam.pygam.ExpectileGAM
. This forces the distribution to be ‘normal’ and link function to ‘identity’. Must be in interval (0, 1).grid¶ (
Union
[str
,Mapping
,None
]) – Whether to perform a grid search. Keys correspond to a parameter names and values to range to be searched. If ‘default’, use the default grid. If None, don’t perform a grid search.**kwargs¶ – Keyword arguments for
pygam.pygam.GAM
.
Attributes
Annotated data object.
Array of shape (n_samples, 2) containing the lower and upper bounds of the confidence interval.
The underlying model.
Whether the model is prepared for fitting.
Filtered weights of shape (n_filtered_cells,) used for fitting.
Unfiltered weights of shape (n_cells,).
Filtered independent variables of shape (n_filtered_cells, 1) used for fitting.
Unfiltered independent variables of shape (n_cells, 1).
Filtered independent variables used when calculating default confidence interval, usually same as
x
.Independent variables of shape (n_samples, 1) used for prediction.
Filtered dependent variables of shape (n_filtered_cells, 1) used for fitting.
Unfiltered dependent variables of shape (n_cells, 1).
Filtered dependent variables used when calculating default confidence interval, usually same as
y
.Prediction values of shape (n_samples,) for
x_test
.Methods
confidence_interval
([x_test])Calculate the confidence interval.
copy
()Return a copy of self.
default_confidence_interval
([x_test])Calculate the confidence interval, if the underlying
model
has no method for it.fit
([x, y, w])Fit the model.
plot
([figsize, same_plot, hide_cells, perc, …])Plot the smoothed gene expression.
predict
([x_test, key_added])Run the prediction.
prepare
(gene, lineage[, backward, …])Prepare the model to be ready for fitting.
read
(fname)Deserialize self from a file.
write
(fname[, ext])Serialize self to a file.