Skip to main content

Flash Amortized Neural Symbolic Regression

Project description

⚡ANSR:
Flash Amortized Neural Symbolic Regression

PyPI version PyPI license Documentation Status

pytest quality checks CodeQL Advanced

Papers

  • WIP

Usage

pip install flash-ansr
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

# Import flash_ansr
from flash_ansr import (
  FlashANSR,
  SoftmaxSamplingConfig,
  install_model,
  get_path,
)

# Select a model from Hugging Face
# https://huggingface.co/models?search=flash-ansr-v23.0
MODEL = "psaegert/flash-ansr-v23.0-120M"

# Download the latest snapshot of the model
# By default, the model is downloaded to the directory `./models/` in the package root
install_model(MODEL)

# Load the model
model = FlashANSR.load(
  directory=get_path('models', MODEL),
  generation_config=SoftmaxSamplingConfig(choices=32),  # or BeamSearchConfig / MCTSGenerationConfig
  n_restarts=8,
).to(device)

# Define data
X = ...
y = ...

# Fit the model to the data
model.fit(X, y, verbose=True)

# Show the best expression
print(model.get_expression())

# Predict with the best expression
y_pred = model.predict(X)

Explore more in the Demo Notebook.

Overview

Training

⚡ANSR Training on Fully Procedurally Generated Data Inspired by NeSymReS (Biggio et al. 2021)

Architecture

FlashANSR Architecture. The model consists of an upgraded version of the Set Transformer (Lee et al. 2019) encoder, and a Pre-Norm Transformer decoder (Vaswani et al. 2017, Xiong et al. 2020) as a generative model over symbolic expressions.

Results

Coming soon

Citation

@mastersthesis{flash-ansr2024-thesis,
  author  = {Paul Saegert},
  title   = {Flash Amortized Neural Symbolic Regression},
  school  = {Heidelberg University},
  year    = {2025},
  url     = {https://github.com/psaegert/flash-ansr-thesis}
}
@software{flash-ansr2024,
  author  = {Paul Saegert},
  title   = {Flash Amortized Neural Symbolic Regression},
  year    = {2024},
  publisher   = {GitHub},
  version = {0.4.4},
  url     = {https://github.com/psaegert/flash-ansr}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flash_ansr-0.4.4.tar.gz (154.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flash_ansr-0.4.4-py3-none-any.whl (173.5 kB view details)

Uploaded Python 3

File details

Details for the file flash_ansr-0.4.4.tar.gz.

File metadata

  • Download URL: flash_ansr-0.4.4.tar.gz
  • Upload date:
  • Size: 154.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flash_ansr-0.4.4.tar.gz
Algorithm Hash digest
SHA256 6cd0026073c85e2299e629ed9db521448dfab276ad31e79db44584e95a7a2153
MD5 db3df680ee5ca982519582d0fdb96bc5
BLAKE2b-256 90983d23855393583b4ec35f1d7246eaf5bc8f62ac4448f53284408ddbc3714a

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_ansr-0.4.4.tar.gz:

Publisher: publish.yaml on psaegert/flash-ansr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flash_ansr-0.4.4-py3-none-any.whl.

File metadata

  • Download URL: flash_ansr-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 173.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flash_ansr-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c4014d6f9b80b71d4f00b01032b114762abd7b79842aa56d146d56f00dfeeae3
MD5 1ab1bebf4ac738b69214cf6cbeec81ce
BLAKE2b-256 1b6b3f551303235df61f1ba9771d4b78e0b6f44ad661fee23817db17d4523c42

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_ansr-0.4.4-py3-none-any.whl:

Publisher: publish.yaml on psaegert/flash-ansr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page