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)

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 SetTransformer (Lee et al. 2019) as an encoder, and a Pre-Norm Transformer decoder (Vaswani et al. 2017) as a generative model over symbolic expressions.

Results

Coming soon

Citation

@software{flash-ansr2024,
    author = {Paul Saegert},
    title = {Flash Amortized Neural Symbolic Regression},
    year = 2024,
    publisher = {GitHub},
    version = {0.4.3},
    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.3.tar.gz (154.5 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.3-py3-none-any.whl (173.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flash_ansr-0.4.3.tar.gz
  • Upload date:
  • Size: 154.5 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.3.tar.gz
Algorithm Hash digest
SHA256 7504f1a8723f2ff1f3934f7d9f972c63518fb1938300c85632ea2ba92cb8f844
MD5 1968716db048bb10c9441c8e142b0bbb
BLAKE2b-256 47c36778fca24b8c2d8741da884690e38f9c0ecb6e1281313a663c46f8cc27dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_ansr-0.4.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: flash_ansr-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 173.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a506434eccd2fe8606e9ca7c0e4ce40f86da83e3672f6468cae5a9cd887243d0
MD5 c9fade7fc23de410d065330a83de449b
BLAKE2b-256 beb2d38cfea78ea99b65353f7835b78462800c7fddd46e7673d2ad2afa41e551

See more details on using hashes here.

Provenance

The following attestation bundles were made for flash_ansr-0.4.3-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