neuromancer.dynamics.sde module
- class neuromancer.dynamics.sde.BaseSDESystem[source]
Bases:
ABC
,Module
Base class for SDEs for integration with TorchSDE library
- abstract f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- abstract g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.Encoder(input_size, hidden_size, output_size)[source]
Bases:
Module
Encoder module to handle time-series data (as in the case of stochastic data and SDE) GRU is used to handle mapping to latent space in this case This class is used only in LatentSDE_Encoder
- forward(inp)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class neuromancer.dynamics.sde.LatentSDE_Decoder(data_size, latent_size, noise_std)[source]
Bases:
BaseSDESystem
Second part of Wrapper for torchsde’s Latent SDE class to integrate with Neuromancer. This takes in output of LatentSDEIntegrator and decodes it back into the “real” data space and also outputs associated Gaussian distributions to be used in the final loss function. Please see https://github.com/google-research/torchsde/blob/master/examples/latent_sde_lorenz.py
- Parameters:
data_size – (int) state size of the data
latent_size – (int) input latent size for the encoder
noise_std – (float) standard deviation of the Gaussian noise applied during decoding
- f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- forward(xs, zs, log_ratio, qz0_mean, qz0_logstd)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.LatentSDE_Encoder(data_size, latent_size, context_size, hidden_size, ts, adjoint=False)[source]
Bases:
BaseSDESystem
- f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- forward(xs)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.LotkaVolterraSDE(a, b, c, d, g_params)[source]
Bases:
BaseSDESystem
- f(t, x)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- g(t, x)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.SDECoxIngersollRand(alpha: float = 0.1, beta: float = 0.05, sigma: float = 0.02)[source]
Bases:
BaseSDESystem
- f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.SDEOrnsteinUhlenbeck(theta: float = 0.1, sigma: float = 0.2)[source]
Bases:
BaseSDESystem
- f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor
- class neuromancer.dynamics.sde.StochasticLorenzAttractor(a: Sequence = (10.0, 28.0, 2.6666666666666665), b: Sequence = (0.1, 0.28, 0.3))[source]
Bases:
BaseSDESystem
- f(t, y)[source]
Define the ordinary differential equations (ODEs) for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The derivatives of the state variables with respect to time.
The output should be of shape [batch size x state size]
- Return type:
Tensor
- g(t, y)[source]
Define the diffusion equations for the system.
- Parameters:
t (Tensor) – The current time (often unused)
y (Tensor) – The current state variables of the system.
- Returns:
- The diffusion coefficients per batch item (output is of size
[batch size x state size]) for noise_type ‘diagonal’
- Return type:
Tensor