Skip to main content

Below is a description of our package

pdefinder is a Python package for discovering partial differential equations (PDEs) from data using data-driven techniques. The package implements methods inspired by PDE-FIND and includes utilities for building candidate libraries, computing numerical derivatives, performing sparse regression, and optimizing candidate coefficients.

Features

  • Candidate Library Construction: Build a library of candidate PDE terms using polynomial functions and numerical differentiation.
  • Numerical Differentiation: Compute derivatives using finite differences, polynomial interpolation, or Tikhonov regularization.
  • Sparse Regression Methods: Available techniques include STRidge, Lasso, ElasticNet, and FoBa.
  • Data Subsampling: Easily subsample data along spatial and temporal dimensions.
  • LLM Integration: Interface with language models (via the OpenAI API) for initial coefficient estimation and verification.
  • Optimization: Utilize CUDA-enabled PyTorch for efficient optimization of PDE coefficients.

Installation

Clone the repository and install the package locally:

git clone https://github.com/Amartya-Roy/pdefinder.git
cd pdefinder
pip install .

Alternatively, build the package distribution and install:

python setup.py sdist bdist_wheel
pip install dist/pdefinder-0.1.0-py3-none-any.whl

Usage

Command-Line Interface

You can run the PDE discovery pipeline from the command line. For example:

pdefinder --dataset KS --data_dir /path/to/data --P 5 --D 5 --epochs 1000

Python API

Import and run the main function in your own script:

from pdefinder import run_pde_finder

# Run the PDE discovery pipeline with custom parameters.
w_final, pde_expression = run_pde_finder(
    dataset='KS',
    P=5,
    D=5,
    num_epochs=1000,
    data_dir='/path/to/data',      
    llm_initial='my_llm',         # Identifier for the initial LLM
    llm_verification='my_llm'     # Identifier for the verification LLM
)

print("Optimized Coefficients:", w_final)
print("Discovered PDE:", pde_expression)

Parameters

  • dataset: The dataset to use.(.mat or .npy format)
  • P: Maximum polynomial power to include in the candidate library (default pipeline).
  • D: Maximum derivative order to include (default pipeline).
  • num_epochs: Number of epochs for the PyTorch optimization step (default pipeline).
  • data_dir: Directory where the dataset files are located.
  • llm_initial: Identifier for the language model used to generate initial coefficient guesses.
  • llm_verification: Identifier for the language model used for verification.

Dependencies

The package requires:

Install the dependencies using pip:

pip install numpy scipy torch openai

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub for any bug reports, feature requests, or improvements.

Acknowledgments

This package is inspired by recent advances in data-driven PDE discovery methods. Special thanks to Soumya Mallick who helped me thinking about this idea.

Repository

For more information, visit the GitHub repository:
https://github.com/Amartya-Roy/pdefinder

Metadata

Release files for pdefinder 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdefinder 0.1.7
File Size Uploaded Provenance Actions
pdefinder-0.1.7.tar.gz 15.0 kB Without provenance Details for pdefinder-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pdefinder 0.1.7
File Interpreter ABI Platform Actions
pdefinder-0.1.7-py3-none-any.whl Python 3 none any Details for pdefinder-0.1.7-py3-none-any.whl

Total release size: 29.0 kB

Release files / pdefinder-0.1.7.tar.gz

Download URL pdefinder-0.1.7.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dfb73c2297821ea3c3c1dc48e0e46611cbdfa6cbb9a221a3fa6cf9fbdb054f80
BLAKE2b-256 checksum
How to use checksums
d1dfa41da5e7d2a6c5cc236e39ff66818eb4ada7b2ccc0043f56a9fdb53c3550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / pdefinder-0.1.7-py3-none-any.whl

Download URL pdefinder-0.1.7-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4a8f0b98ca0c243699afc5402cae67ac01c7fd0073d4adc401799c78a7d6f98
BLAKE2b-256 checksum
How to use checksums
73cb47fd688a4c89eb727e0ea60304e4db5470caebcfa096e04b41a81b038dec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for pdefinder 0.1.7

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.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page