pydeseq2.grid_search
Functions
|
Find best dispersion parameter. |
|
Find best LFC parameter. |
|
Find best LFC parameter. |
|
Return the negative log-likelihood of a negative binomial. |
- pydeseq2.grid_search.grid_fit_alpha(counts, design_matrix, mu, alpha_hat, min_disp, max_disp, prior_disp_var=None, cr_reg=True, prior_reg=False, grid_length=100)
Find best dispersion parameter.
Performs 1D grid search to maximize negative binomial log-likelihood.
- Parameters
counts (ndarray) – Raw counts for a given gene.
design_matrix (ndarray) – Design matrix.
mu (ndarray) – Mean estimation for the NB model.
alpha_hat (float) – Initial dispersion estimate.
min_disp (float) – Lower threshold for dispersion parameters.
max_disp (float) – Upper threshold for dispersion parameters.
prior_disp_var (float) – Prior dispersion variance.
cr_reg (bool) – Whether to use Cox-Reid regularization. (default: True).
prior_reg (bool) – Whether to use prior log-residual regularization. (default: False).
grid_length (int) – Number of grid points. (default: 100).
- Returns
Logarithm of the fitted dispersion parameter.
- Return type
- pydeseq2.grid_search.grid_fit_beta(counts, size_factors, design_matrix, disp, min_mu=0.5, grid_length=60, min_beta=- 30, max_beta=30)
Find best LFC parameter.
Perform 2D grid search to maximize negative binomial GLM log-likelihood w.r.t. LFCs.
- Parameters
counts (ndarray) – Raw counts for a given gene.
size_factors (pandas.Series) – DESeq2 normalization factors.
design_matrix (ndarray) – Design matrix.
disp (float) – Gene-wise dispersion prior.
min_mu (float) – Lower threshold for dispersion parameters.
grid_length (int) – Number of grid points. (default: 100).
min_beta (int) – Lower-bound on LFC. (default: 30).
max_beta (int) – Upper-bound on LFC. (default: 30).
- Returns
Fitted LFC parameter.
- Return type
- pydeseq2.grid_search.grid_fit_shrink_beta(counts, offset, design_matrix, size, prior_no_shrink_scale, prior_scale, scale_cnst, grid_length=60, min_beta=- 30, max_beta=30)
Find best LFC parameter.
Performs 2D grid search to maximize MAP negative binomial GLM log-likelihood w.r.t. LFCs, with apeGLM prior.
- Parameters
counts (ndarray) – Raw counts for a given gene.
offset (ndarray) – Natural logarithm of size factor.
design_matrix (ndarray) – Design matrix.
size (ndarray) – Size parameter of NB family (inverse of dispersion).
prior_no_shrink_scale (float) – Prior variance for the intercept.
prior_scale (float) – Prior variance for the LFC coefficient.
scale_cnst (float) – Scaling factor for the optimization.
grid_length (int) – Number of grid points. (default: 100).
min_beta (int) – Lower-bound on LFC. (default: 30).
max_beta (int) – Upper-bound on LFC. (default: 30).
- Returns
Fitted MAP LFC parameter.
- Return type
- pydeseq2.grid_search.vec_nb_nll(counts, mu, alpha)
Return the negative log-likelihood of a negative binomial.
Vectorized version.