innovate.diffuse.logistic module¶
- class innovate.diffuse.logistic.LogisticModel(covariates: Sequence[str] = None, t_event: float = None)[source]¶
Bases:
DiffusionModel
Implementation of the Logistic Diffusion Model. This is a wrapper around the SymmetricGrowth dynamics model.
- bounds(t: Sequence[float], y: Sequence[float]) Dict[str, tuple] [source]¶
Return parameter bounds for the logistic model, including covariate effects.
- Parameters:
t (Sequence[float]) – Time points of the observations.
y (Sequence[float]) – Observed values corresponding to each time point.
- Returns:
Dictionary mapping parameter names to their (lower, upper) bounds.
- Return type:
Dict[str, tuple]
- differential_equation(t, y, params, covariates, t_eval)[source]¶
Differential equation for the logistic model.
- initial_guesses(t: Sequence[float], y: Sequence[float]) Dict[str, float] [source]¶
Returns initial guesses for the model parameters.
- property param_names: Sequence[str]¶
Return the list of parameter names for the logistic model, including base parameters and covariate-specific coefficients.
- property params_: Dict[str, float]¶
Returns a dictionary of fitted model parameters.
- predict(t: Sequence[float], covariates: Dict[str, Sequence[float]] = None) Sequence[float] [source]¶
Predicts the cumulative values of the logistic diffusion process at specified time points.
- Parameters:
t (Sequence[float]) – Time points at which to compute predictions.
covariates (Dict[str, Sequence[float]], optional) – Covariate values for each time point.
- Returns:
Predicted cumulative values of the logistic model at each time point.
- Return type:
Sequence[float]
- Raises:
RuntimeError – If the model parameters have not been set (i.e., the model is not fitted).
- predict_adoption_rate(t: Sequence[float], covariates: Dict[str, Sequence[float]] = None) Sequence[float] [source]¶
Predicts the rate of adoption (new adoptions per unit of time).
- score(t: Sequence[float], y: Sequence[float], covariates: Dict[str, Sequence[float]] = None) float [source]¶
Compute the coefficient of determination (R²) between observed values and model predictions.
- Parameters:
t (Sequence[float]) – Time points at which observations were made.
y (Sequence[float]) – Observed values corresponding to time points.
covariates (Dict[str, Sequence[float]], optional) – Covariate values for each time point.
- Returns:
The R² score indicating the proportion of variance explained by the model predictions.
- Return type:
float
- Raises:
RuntimeError – If the model has not been fitted.