LightningSDE_FixedPotential#
- class scdiffeq.core.lightning_models._lightning_sde_fixed_potential.LightningSDE_FixedPotential(latent_dim: int = 50, name: str | None = None, mu_hidden: ~typing.List[int] | int = [2000, 2000], sigma_hidden: ~typing.List[int] | int = [800, 800], mu_activation: str | ~typing.List[str] = 'LeakyReLU', sigma_activation: str | ~typing.List[str] = 'LeakyReLU', mu_dropout: float | ~typing.List[float] = 0.1, sigma_dropout: float | ~typing.List[float] = 0.1, mu_bias: bool = True, sigma_bias: ~typing.List[bool] = True, mu_output_bias: bool = True, sigma_output_bias: bool = True, mu_n_augment: int = 0, sigma_n_augment: int = 0, sde_type='ito', noise_type='general', brownian_dim=1, coef_drift: float = 1.0, coef_diffusion: float = 1.0, train_lr: float = 0.0001, train_optimizer=<class 'torch.optim.rmsprop.RMSprop'>, train_scheduler=<class 'torch.optim.lr_scheduler.StepLR'>, train_step_size: int = 10, dt: float = 0.1, adjoint=False, backend='auto', loading_existing: bool = False, *args, **kwargs)[source]#
Bases:
PotentialMixIn,BaseForwardMixIn,BaseLightningDiffEq- Parameters:
latent_dim (int, optional) – Dimensionality of the latent space, by default 50.
name (str, optional) – Name of the model, by default None.
mu_hidden (Union[List[int], int], optional) – Hidden layer sizes for the drift neural network, by default [2000, 2000].
sigma_hidden (Union[List[int], int], optional) – Hidden layer sizes for the diffusion neural network, by default [800, 800].
mu_activation (Union[str, List[str]], optional) – Activation function(s) for the drift neural network, by default ‘LeakyReLU’.
sigma_activation (Union[str, List[str]], optional) – Activation function(s) for the diffusion neural network, by default ‘LeakyReLU’.
mu_dropout (Union[float, List[float]], optional) – Dropout rate(s) for the drift neural network, by default 0.1.
sigma_dropout (Union[float, List[float]], optional) – Dropout rate(s) for the diffusion neural network, by default 0.1.
mu_bias (bool, optional) – Whether to use bias in the drift neural network, by default True.
sigma_bias (List[bool], optional) – Whether to use bias in the diffusion neural network, by default True.
mu_output_bias (bool, optional) – Whether to use bias in the output layer of the drift neural network, by default True.
sigma_output_bias (bool, optional) – Whether to use bias in the output layer of the diffusion neural network, by default True.
mu_n_augment (int, optional) – Number of augmentations for the drift neural network, by default 0.
sigma_n_augment (int, optional) – Number of augmentations for the diffusion neural network, by default 0.
sde_type (str, optional) – Type of stochastic differential equation, by default ‘ito’.
noise_type (str, optional) – Type of noise, by default ‘general’.
brownian_dim (int, optional) – Dimensionality of the Brownian motion, by default 1.
coef_drift (float, optional) – Coefficient of drift, by default 1.0.
coef_diffusion (float, optional) – Coefficient of diffusion, by default 1.0.
train_lr (float, optional) – Learning rate for training, by default 1e-4.
train_optimizer (Optimizer, optional) – Optimizer for training, by default torch.optim.RMSprop.
train_scheduler (torch.optim.lr_scheduler._LRScheduler, optional) – Learning rate scheduler for training, by default torch.optim.lr_scheduler.StepLR.
train_step_size (int, optional) – Step size for the learning rate scheduler, by default 10.
dt (float, optional) – Time step for the SDE solver, by default 0.1.
adjoint (bool, optional) – Whether to use the adjoint method for the SDE solver, by default False.
backend (str, optional) – Backend for the SDE solver, by default “auto”.
loading_existing (bool, optional) – Whether to load an existing model, by default False.
- Return type:
None
Notes
This class implements a fixed potential SDE using PyTorch Lightning.
Examples
>>> model = LightningSDE_FixedPotential(latent_dim=20, dt=0.05) >>> model.fit(data)
- __init__(latent_dim: int = 50, name: str | None = None, mu_hidden: ~typing.List[int] | int = [2000, 2000], sigma_hidden: ~typing.List[int] | int = [800, 800], mu_activation: str | ~typing.List[str] = 'LeakyReLU', sigma_activation: str | ~typing.List[str] = 'LeakyReLU', mu_dropout: float | ~typing.List[float] = 0.1, sigma_dropout: float | ~typing.List[float] = 0.1, mu_bias: bool = True, sigma_bias: ~typing.List[bool] = True, mu_output_bias: bool = True, sigma_output_bias: bool = True, mu_n_augment: int = 0, sigma_n_augment: int = 0, sde_type='ito', noise_type='general', brownian_dim=1, coef_drift: float = 1.0, coef_diffusion: float = 1.0, train_lr: float = 0.0001, train_optimizer=<class 'torch.optim.rmsprop.RMSprop'>, train_scheduler=<class 'torch.optim.lr_scheduler.StepLR'>, train_step_size: int = 10, dt: float = 0.1, adjoint=False, backend='auto', loading_existing: bool = False, *args, **kwargs) None[source]#
LightningSDE_FixedPotential
- Parameters:
latent_dim (int, optional) – Dimensionality of the latent space, by default 50.
name (str, optional) – Name of the model, by default None.
mu_hidden (Union[List[int], int], optional) – Hidden layer sizes for the drift neural network, by default [2000, 2000].
sigma_hidden (Union[List[int], int], optional) – Hidden layer sizes for the diffusion neural network, by default [800, 800].
mu_activation (Union[str, List[str]], optional) – Activation function(s) for the drift neural network, by default ‘LeakyReLU’.
sigma_activation (Union[str, List[str]], optional) – Activation function(s) for the diffusion neural network, by default ‘LeakyReLU’.
mu_dropout (Union[float, List[float]], optional) – Dropout rate(s) for the drift neural network, by default 0.1.
sigma_dropout (Union[float, List[float]], optional) – Dropout rate(s) for the diffusion neural network, by default 0.1.
mu_bias (bool, optional) – Whether to use bias in the drift neural network, by default True.
sigma_bias (List[bool], optional) – Whether to use bias in the diffusion neural network, by default True.
mu_output_bias (bool, optional) – Whether to use bias in the output layer of the drift neural network, by default True.
sigma_output_bias (bool, optional) – Whether to use bias in the output layer of the diffusion neural network, by default True.
mu_n_augment (int, optional) – Number of augmentations for the drift neural network, by default 0.
sigma_n_augment (int, optional) – Number of augmentations for the diffusion neural network, by default 0.
sde_type (str, optional) – Type of stochastic differential equation, by default ‘ito’.
noise_type (str, optional) – Type of noise, by default ‘general’.
brownian_dim (int, optional) – Dimensionality of the Brownian motion, by default 1.
coef_drift (float, optional) – Coefficient of drift, by default 1.0.
coef_diffusion (float, optional) – Coefficient of diffusion, by default 1.0.
train_lr (float, optional) – Learning rate for training, by default 1e-4.
train_optimizer (Optimizer, optional) – Optimizer for training, by default torch.optim.RMSprop.
train_scheduler (torch.optim.lr_scheduler._LRScheduler, optional) – Learning rate scheduler for training, by default torch.optim.lr_scheduler.StepLR.
train_step_size (int, optional) – Step size for the learning rate scheduler, by default 10.
dt (float, optional) – Time step for the SDE solver, by default 0.1.
adjoint (bool, optional) – Whether to use the adjoint method for the SDE solver, by default False.
backend (str, optional) – Backend for the SDE solver, by default “auto”.
loading_existing (bool, optional) – Whether to load an existing model, by default False.
- Return type:
None
Notes
This class implements a fixed potential SDE using PyTorch Lightning.
Examples
>>> model = LightningSDE_FixedPotential(latent_dim=20, dt=0.05) >>> model.fit(data)