leaspy.models.logistic#

Classes#

LogisticInitializationMixin

LogisticModel

Manifold model for multiple variables of interest (logistic formulation).

Module Contents#

class LogisticInitializationMixin#
class LogisticModel(name, **kwargs)#

Bases: LogisticInitializationMixin, leaspy.models.riemanian_manifold.RiemanianManifoldModel

Manifold model for multiple variables of interest (logistic formulation).

Parameters:

name (str)

get_variables_specs()#

Return the specifications of the variables (latent variables, derived variables, model ‘parameters’) that are part of the model.

Returns:
NamedVariables

A dictionary-like object mapping variable names to their specifications.

Return type:

NamedVariables

static metric(*, g)#

Compute the metric tensor from input tensor g. This function calculates the metric as ((g + 1)^2 / g) element-wise.

Parameters:
gtorch.Tensor

Input tensor with values of the population parameter g for each feature.

Returns:
torch.Tensor

The computed metric tensor, same shape as g(number of features)

Parameters:

g (Tensor)

Return type:

Tensor

classmethod model_with_sources(*, rt, space_shifts, metric, v0, g)#

Return the model output when sources(spatial components) are present.

Parameters:
rtTensorOrWeightedTensor[float]

Tensor containing the reparametrized time.

space_shiftsTensorOrWeightedTensor[float]

Tensor containing the values of the space-shifts

metricTensorOrWeightedTensor[float]

Tensor containing the metric tensor used for computing the spatial/temporal influence.

v0TensorOrWeightedTensor[float]

Tensor containing the values of the population parameter v0 for each feature.

gTensorOrWeightedTensor[float]

Tensor containing the values of the population parameter g for each feature.

Returns:
torch.Tensor

Weighted value tensor after applying sigmoid transformation, representing the model output with sources.

Parameters:
  • rt (leaspy.utils.weighted_tensor.TensorOrWeightedTensor[float])

  • space_shifts (leaspy.utils.weighted_tensor.TensorOrWeightedTensor[float])

  • metric (leaspy.utils.weighted_tensor.TensorOrWeightedTensor[float])

  • v0 (leaspy.utils.weighted_tensor.TensorOrWeightedTensor[float])

  • g (leaspy.utils.weighted_tensor.TensorOrWeightedTensor[float])

Return type:

Tensor