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,
)

# Specify the model
# Here: https://huggingface.co/psaegert/flash-ansr-v23.0-120M
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.2},
    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.2.tar.gz (154.4 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.2-py3-none-any.whl (173.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flash_ansr-0.4.2.tar.gz
  • Upload date:
  • Size: 154.4 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.2.tar.gz
Algorithm Hash digest
SHA256 c5a036f7f10f0343f44e520603c6919ed6cefc22776526c5d68b0c4bef674704
MD5 70382b879709a2a4923963980a333d1e
BLAKE2b-256 e93d2616d7278baf2ae213bbc2bb31e9c2260c4b18b99acf591cfe66807fecaa

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: flash_ansr-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 173.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 459b7c0f997deda71ea27853f75ff321a7c7c93654872eabb7191787b939813f
MD5 d1068f57537a2b4d43a9d09fee2e972e
BLAKE2b-256 4b90838a20dea2040e4993d31aeff0853b522cea137b5f28130cd66e7e1ea971

See more details on using hashes here.

Provenance

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