leaspy.models.shared_speed_logistic

Classes

SharedSpeedLogisticModel

Logistic model for multiple variables of interest, imposing same average

Module Contents

class SharedSpeedLogisticModel(name, **kwargs)[source]

Bases: leaspy.models.logistic.LogisticInitializationMixin, leaspy.models.time_reparametrized.TimeReparametrizedModel

Logistic model for multiple variables of interest, imposing same average evolution pace for all variables (logistic curves are only time-shifted).

Parameters:
namestr

The name of the model.

**kwargs

Hyperparameters of the model.

Parameters:

name (str)

static metric(*, g_deltas_exp)[source]

Compute the metric term for the logistic model.

This scaling term modulates the curvature of the logistic trajectory.

Parameters:
g_deltas_exptorch.Tensor

Product of slope and exp(-deltas).

Returns:
torch.Tensor
Metric value, computed as:
\[\frac{(g \cdot e^{-\delta} + 1)^2}{g \cdot e^{-\delta}}\]
Parameters:

g_deltas_exp (Tensor)

Return type:

Tensor

static deltas_exp(*, deltas_padded)[source]

Compute the exponential of the negative deltas.

Parameters:

deltas_padded (torch.Tensor): Padded deltas.

Returns:

torch.Tensor: Exponential of the negative deltas.

Parameters:

deltas_padded (Tensor)

Return type:

Tensor

static g_deltas_exp(*, g, deltas_exp)[source]
Parameters:
Return type:

Tensor

static pad_deltas(*, deltas)[source]

Prepend deltas with a zero as delta_1 is set to zero in the equations. .

Parameters:

deltas (torch.Tensor): Deltas tensor.

Returns:

torch.Tensor: Padded deltas tensor.

Parameters:

deltas (Tensor)

Return type:

Tensor

static denom(*, g_deltas_exp)[source]

Compute the denominator for the \(\gamma_{t_0}\) calculation.

Parameters:

g_deltas_exp (Tensor)

Return type:

Tensor

static gamma_t0(*, denom)[source]

Compute the \(\gamma_{t_0}\) value, which is the inverse of the denominator.

Parameters:
denomtorch.Tensor

Denominator term.

Returns:
torch.Tensor

\(\gamma_{t_0}\) value.

Parameters:

denom (Tensor)

Return type:

Tensor

static g_metric(*, gamma_t0)[source]

Compute the g_metric value, which is the square of gamma_t0.

Parameters:
gamma_t0torch.Tensor

\(\gamma_{t_0}\) value.

Returns:
torch.Tensor
\(g_{metric}\) value, computed as:
\[g\_metric = \frac{1}{(\gamma_{t0} \cdot (1 - \gamma_{t0}))^2}\]
Parameters:

gamma_t0 (Tensor)

Return type:

Tensor

static collin_to_d_gamma_t0(*, deltas_exp, denom)[source]

Compute the collinear term to d_gamma_t0.

Parameters:
deltas_exptorch.Tensor

Exponential of the negative deltas.

denomtorch.Tensor

Denominator term.

Returns:
torch.Tensor

Collinear term to d_gamma_t0

Parameters:
Return type:

Tensor

classmethod model_with_sources(*, rt, space_shifts, metric, deltas_padded, log_g)[source]

Returns a model with sources.

Parameters:
Return type:

Tensor

classmethod model_no_sources(*, rt, metric, deltas_padded, log_g)[source]

Returns a model without sources.

Parameters:
Return type:

Tensor

get_variables_specs()[source]

Get the specifications of the variables used in the model.

Return type:

NamedVariables