leaspy.models.factory#

Classes#

ModelName

The available models that users can instantiate in Leaspy.

Functions#

model_factory(name[, instance_name])

Return the model object corresponding to name arg with possible kwargs.

Module Contents#

class ModelName#

Bases: str, enum.Enum

The available models that users can instantiate in Leaspy.

JOINT = 'joint'#
LOGISTIC = 'logistic'#
LINEAR = 'linear'#
SHARED_SPEED_LOGISTIC = 'shared_speed_logistic'#
LME = 'lme'#
CONSTANT = 'constant'#
MIXTURE_LOGISTIC = 'mixture_logistic'#
model_factory(name, instance_name=None, **kwargs)#

Return the model object corresponding to name arg with possible kwargs.

Parameters:
namestr or ModelName
The name of the model class to be instantiated. Valid options include:
  • "joint"

  • "logistic"

  • "linear"

  • "shared_speed_logistic"

  • "lme"

  • "constant"

  • "mixture_logistic"

instance_namestr, optional

A custom name for the model instance. If not provided, the model’s name will be used as the instance name.

**kwargs

Additional keyword arguments corresponding to the model’s hyperparameters. These must be valid for the specified model, or an error will be raised.

Returns:
BaseModel

A child class object of BaseModel class object determined by name.

Raises:
ValueError

If an invalid model name is provided or the model cannot be instantiated with the provided arguments.

Parameters:
Return type:

BaseModel