NODEFit
Fit time-series data with a Neural Differential Equation!
This repository contains time-series data fit capabilities using both Neural Ordinary Differential Equations and Neural Stochastic Differential Equations
GPU support is packaged as part of PyTorch
Also checkout its Julia version
How to install and execute?
Tested on Python 3.9
Just run
pip install nodefit
The following program illustrates a basic example
import numpy as np
import torch.nn as nn
from nodefit.constants import DEVICE
from nodefit.neural_ode import NeuralODE
from nodefit.neural_sde import NeuralSDE
###
# DEFINE NETWORKS
###
# Neural ODE parameters
ndim, drift_nhidden, diffusion_nhidden = 2, 10, 2
drift_nn = nn.Sequential(
nn.Linear(ndim+1, drift_nhidden),
nn.Sigmoid(),
nn.Linear(drift_nhidden, ndim)
).double().to(DEVICE)
diffusion_nn = nn.Sequential(
nn.Linear(ndim+1, diffusion_nhidden),
nn.Sigmoid(),
nn.Linear(diffusion_nhidden, ndim)
).double().to(DEVICE)
###
# PROVIDE DATA
###
# Training between data for 0 and 5 seconds
t = np.linspace(0, 5, 10)
# Provide data as list of lists with starting condition
data = np.array([[...]])
###
# FIT USING NEURALODE
###
print('Performing fit using Neural ODE...')
neural_ode = NeuralODE(drift_nn, t, data)
neural_ode.train(2000)
# # Extrapolate the training data to 10 seconds
extra_data = neural_ode.extrapolate(10)
neural_ode.plot(extra_data)
###
# FIT USING NEURALSDE
###
print('Performing fit using Neural SDE...')
neural_sde = NeuralSDE(drift_nn, diffusion_nn, t, data)
neural_sde.train(1)
# # Extrapolate the training data to 10 seconds
extra_data = neural_sde.extrapolate(10)
neural_sde.plot(extra_data)
Sample Output
Whom to contact?
Please direct your queries to gpavanb1 for any questions.
Acknowledgements
This package would not be possible without the supporting packages - torchdiffeq and torchsde
Metadata
Release files for NODEFit 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nodefit-0.2.tar.gz | 6.8 kB | Without provenance | Details for nodefit-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nodefit-0.2-py3-none-any.whl | Python 3 | none | any | Details for nodefit-0.2-py3-none-any.whl |
Total release size: 15.0 kB
Release files / nodefit-0.2.tar.gz
| Download URL | nodefit-0.2.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
008829325c4b35b5b3a79ba22f2babe503d06aba863143ba7729f11ccafc80f5
|
|
BLAKE2b-256 checksum How to use checksums |
9af8e06b9a04dffdd292bb7fd3a3795e900cffbfe4b2b4d6aedcfc0c18f76b2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / nodefit-0.2-py3-none-any.whl
| Download URL | nodefit-0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf9dedd70df90661ade2b40f73c2e41eebf1b3ac650721260c7c20e08357ab4c
|
|
BLAKE2b-256 checksum How to use checksums |
59131b41ed6c6e872034c712dab31beaa1ed3f98c4d51528e32b08e3464ad4c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for NODEFit 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.