Esta biblioteca fornece solucionadores de equações diferenciais estocásticas (SDE) com suporte à GPU e retropacatação eficiente.

pip install torchsdeRequisitos: python> = 3.8 e pytorch> = 1.6.0.
Disponível aqui.
import torch
import torchsde
batch_size , state_size , brownian_size = 32 , 3 , 2
t_size = 20
class SDE ( torch . nn . Module ):
noise_type = 'general'
sde_type = 'ito'
def __init__ ( self ):
super (). __init__ ()
self . mu = torch . nn . Linear ( state_size ,
state_size )
self . sigma = torch . nn . Linear ( state_size ,
state_size * brownian_size )
# Drift
def f ( self , t , y ):
return self . mu ( y ) # shape (batch_size, state_size)
# Diffusion
def g ( self , t , y ):
return self . sigma ( y ). view ( batch_size ,
state_size ,
brownian_size )
sde = SDE ()
y0 = torch . full (( batch_size , state_size ), 0.1 )
ts = torch . linspace ( 0 , 1 , t_size )
# Initial state y0, the SDE is solved over the interval [ts[0], ts[-1]].
# ys will have shape (t_size, batch_size, state_size)
ys = torchsde . sdeint ( sde , y0 , ts ) examples/demo.ipynb fornece um pequeno guia sobre como resolver SDEs, incluindo pontos sutis, como fixar a aleatoriedade no solucionador e a escolha dos tipos de ruído .
examples/latent_sde.py aprende uma equação diferencial estocástica latente , como na seção 5 de [1]. O exemplo se encaixa em um SDE para os dados, enquanto regulariza-o como um processo anterior de Ornstein-Uhlenbeck. O modelo pode ser visto vagamente como um autoencoder variacional, com seus SDEs anteriores e aproximados. Este exemplo pode ser executado via
python -m examples.latent_sde --train-dir < TRAIN_DIR > O programa gera figuras para o caminho especificado por <TRAIN_DIR> . O treinamento deve se estabilizar após 500 iterações com os hiperparâmetros padrão.
examples/sde_gan.py Aprende um SDE como um gan, como em [2], [3]. O exemplo treina um SDE como o gerador de um GaN, enquanto usa um CDE neural [4] como discriminador. Este exemplo pode ser executado via
python -m examples.sde_ganSe você achou esta base de código útil em sua pesquisa, considere citar um ou ambos:
@article{li2020scalable,
title={Scalable gradients for stochastic differential equations},
author={Li, Xuechen and Wong, Ting-Kam Leonard and Chen, Ricky T. Q. and Duvenaud, David},
journal={International Conference on Artificial Intelligence and Statistics},
year={2020}
}
@article{kidger2021neuralsde,
title={Neural {SDE}s as {I}nfinite-{D}imensional {GAN}s},
author={Kidger, Patrick and Foster, James and Li, Xuechen and Oberhauser, Harald and Lyons, Terry},
journal={International Conference on Machine Learning},
year={2021}
}
[1] Xuechen Li, Ting-Kam Leonard Wong, Ricky TQ Chen, David Duvenaud. "Gradientes escaláveis para equações diferenciais estocásticas". Conferência Internacional sobre Inteligência Artificial e Estatística. 2020. [Arxiv]
[2] Patrick Kidger, James Foster, Xuechen Li, Harald Oberhauser, Terry Lyons. "SDEs neurais como Gans infinitos-dimensionais". Conferência Internacional sobre Aprendizagem de Máquinas 2021. [Arxiv]
[3] Patrick Kidger, James Foster, Xuechen Li, Terry Lyons. "Gradientes eficientes e precisos para SDEs neurais". 2021. [Arxiv]
[4] Patrick Kidger, James Morrill, James Foster, Terry Lyons, "Equações diferenciais controladas neurais para séries temporais irregulares". Sistemas de processamento de informações neurais 2020. [ARXIV]
Este é um projeto de pesquisa, não um produto oficial do Google.