tdm.model.LogisticRegressionModel#

class tdm.model.LogisticRegressionModel(dataset: Dataset, regularization_alpha: float | Literal['score'] = 0, score_kwargs: dict | None = None, cv_kwargs: dict | None = None, maxiter: int = 100, **kwargs)[source]#

A Model that models probabilities using logistic regression.

__init__(dataset: Dataset, regularization_alpha: float | Literal['score'] = 0, score_kwargs: dict | None = None, cv_kwargs: dict | None = None, maxiter: int = 100, **kwargs) None[source]#

Initialize and fit the model

Parameters:
  • dataset (Dataset) – _description_

  • regularization_alpha (float | Literal["score", "significance"], optional) – _description_. Defaults to 0.

  • score_kwargs (dict | None, optional) – passed to self._fit_score_optimized_model(…)

  • maxiter (int, optional) – _description_. Defaults to 100.

Note

See Model base class for all available model kwargs.

fit(features: DataFrame, obs: Series, cell_type: str, regularization_alpha: float | Literal['score', 'cv'] | dict[str, float] = 0, score_kwargs: dict | None = None, cv_kwargs: dict | None = None, **kwargs) BinaryResultsWrapper | L1BinaryResultsWrapper[source]#

Fits a single model to X=features, y=obs

Note: By default, Logit doesn’t fit an intercept term.

get_parameter(cell_type: str, parameter_name: str, obs: Literal['division'] = 'division') None[source]#

Gets the value of a parameter in the model.

parameter_names(cell_type: str, obs: Literal['death', 'division']) ndarray[source]#

Returns the parameter names associated with the death / division model for cells of type cell_type.

parameter_pvalues(cell_type: str, obs: Literal['death', 'division']) ndarray[source]#

Returns the parameters associated with the death / division model for cells of type cell_type.

parameter_stds(cell_type: str, obs: Literal['death', 'division']) ndarray[source]#

Returns the parameters associated with the death / division model for cells of type cell_type.

parameters(cell_type: str, obs: Literal['death', 'division']) ndarray[source]#

Returns the parameters associated with the death / division model for cells of type cell_type.

set_parameter(cell_type: str, parameter_name: str, value: float, obs: Literal['division'] = 'division') None[source]#

Sets the value of a parameter in the model.

set_parameters(cell_type: str, obs: Literal['death', 'division'], new_params: list[float] | ndarray) None[source]#

Replaces the parameters associated with the death / division model for cells of type cell_type with values.