Skip to main content

beamfeat

CI Tests PyPI Python License: MIT TMLR DOI Docs

beamfeat builds readable formulas from the columns of a table, such as (x0 / x2) * x1 or log(a) * log(b), tests each against the null hypothesis that it is independent of the target, and keeps only those whose null is rejected, with a stated false-discovery-rate guarantee. The result is a short equation in your own column names, from a scikit-learn estimator you can fit, inspect and predict with. The method is described in a TMLR 2026 paper.

New in 0.7.0

  • The search finds laws whose parts do not correlate with the target, such as x0*x1*x2 with centred inputs (magnitude_slots, on by default for regression).
  • It rules out quotients whose denominator comes near zero, which on tecator's high-fat samples had predicted up to 507% fat, and predict warns when a new row takes a feature far beyond its training range.
  • A new Choosing a setting page: when to keep the default, and when to ask for a short equation or for every column to be tested.
  • certify_test="conditional" after the forward step now needs parsimony_alpha; without it, it warns, and it will raise from 0.8.
  • The code is split into smaller modules, mapped in ARCHITECTURE.md.

On real data the held-out score rose on 3 of 12 datasets and fell on none, and fits take a quarter longer than in the previous release. The release comparison compares the paper's release with the later ones on accuracy, speed and memory.

An example: fat content from a spectrum

Held-out R² on tecator over five splits: beamfeat 0.991 from three or four formulas; ridge 0.957, LightGBM 0.756 and random forest 0.717 on all 100 channels

In the tecator data, the task is to predict the fat content of meat samples from 100 near-infrared absorbance channels. Over five random 75/25 splits, beamfeat's equation uses three or four formulas, mostly ratios of channel differences such as ((x35 - x42) / (x37 - x39)), and reaches a mean held-out R² of 0.991 in the paper (0.990 with 0.7.0). On all 100 channels, ridge regression reaches 0.957, a random forest 0.717 and LightGBM 0.756. A random forest given the formulas in place of the raw channels goes from 0.739 to 0.992, on three of the five splits. Against the methods of chemometrics, compared since the paper, 0.7.0's error is 46 to 62% of that of partial least squares (R² 0.951 to 0.971), and the error of kernel methods on second-derivative spectra (R² 0.996 to 0.998) is 46 to 59% of beamfeat's, from every channel and with no formula to read.

The accuracy is stable from split to split; which ratios are picked is not. Neighbouring channels correlate at 0.99988, so many ratios are nearly interchangeable, and each split settles on its own. stability_report measures this on any data: it refits on many random splits and counts the distinct equations.

The numbers are the paper's (Table 6 and its appendices), from the archived run in benchmarks/additional_experiments/, except the chemometrics comparison, from benchmarks/tecator_chemometrics/; benchmarks/figures/tecator.py draws the plot. The Benchmarks page has all nine datasets of that study, including those where beamfeat trails.

Install

pip install beamfeat              # core: numpy, scikit-learn, joblib
pip install "beamfeat[units]"     # + pint, for units
pip install "beamfeat[display]"   # + sympy, for to_sympy() and latex()
pip install "beamfeat[all]"       # + both, pandas and the test dependencies

Python 3.10 or newer, with no upper version pins: the 1,004 tests pass on Python 3.10 to 3.15 with the newest releases each supports, and the suite runs on the oldest supported stack too. Installation lists the versions, and how to run the tests or reproduce the benchmarks.

It fits like any scikit-learn estimator:

from beamfeat import BeamFeatRegressor

model = BeamFeatRegressor().fit(X, y)

model.formulas()        # ['((x0 / x2) * x1)', ...]
model.equation()        # 'y = 0.9847*((x0 / x2) * x1) + ...'
model.fdr_controlled_   # True: the features carry the stated FDR guarantee
model.predict(X_new)

Three settings

BeamFeatRegressor()                        # the equation that predicts best
BeamFeatRegressor(parsimony_alpha=0.05)    # a short equation, to read or report
BeamFeatRegressor(input_test=True)         # every column inside each formula tested

On noisy data the default's equation can carry extra terms. On y = x0/x1 among ten unrelated columns, with noise as large as the signal, it printed a median of 9.5 terms, most of them reading an unrelated column, and parsimony_alpha=0.05 printed the one true term in every fit. On real data, which rarely follow one compact formula, parsimony_alpha gives up some held-out score, and input_test takes 2 to 7 times as long. Choosing a setting has the measurements.

What you get

  • Readable formulas. formulas() lists the features, and equation() prints the fitted model in your column names.
  • The equation at every size. equations() lists one equation per number of terms, with the R² each term adds.
  • LaTeX and SymPy. latex() typesets the equation, and to_sympy() hands the features to SymPy, and from there to NumPy, JAX or PyTorch.
  • Units. Give the columns units, as strings such as "kg" or as pint quantities, and dimensionally invalid expressions are never built.
  • A guarantee code can check. fdr_controlled_ says whether the features carry the guarantee, and fdr_scope_ whether it covers the printed equation or the larger certified set the equation was drawn from.
  • Fitted constants. Expressions can carry one constant fitted inside them, such as exp(a*x) and 1/(x + a), which recovers laws like exp(-x^2/2) exactly. On by default; fitted_ops=() turns it off.
  • Hidden building blocks. magnitude_slots keeps a few beam places for parts whose size tracks the target's even when they do not correlate with it, such as x0 and x1 in y = x0*x1 with centred inputs. On by default for regression; magnitude_slots=0 turns it off.
  • Every column in a formula tested, opt in. input_test=True tests each column inside each formula, and drops a formula when the test fails to reject the null for one of its columns, such as x6 in (x0 * x1) / (x0 + x6).
  • Stability. stability_report refits on many splits and shows whether the equation is the only good one or one of many.
  • A warning beyond the training data. predict and transform warn when a new row takes a feature far beyond its range on the training rows, and the search rules out quotients whose denominator comes close to zero there.

The guarantee

The search runs on half of the training rows. On the other half, each formula it returns is tested against the null hypothesis that it is independent of the target, with a permutation test and the Benjamini–Yekutieli correction. The formulas whose nulls are rejected are the certified set, and on average at most 10% of them are false discoveries (target_fdr). That is an average over repeated fits, not a promise about any one fit, and it covers the certified set, of which the printed equation is by default a compact subset. A formula is a false discovery only when it is independent of the target, so (x0*x1)/(x1 + x8) is a true one when y = x0*x1, however unrelated x8 is; input_test=True tests each column inside each formula. If no null is rejected, the model uses no formulas and warns. Statistical guarantees gives each procedure's assumptions and what was measured.

Documentation

Citing

If you use beamfeat, please cite the paper:

@article{
daramola2026symbolic,
title={Symbolic feature construction with false discovery rate control},
author={Olanrewaju M. Daramola},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2026},
url={https://openreview.net/forum?id=UibXoy4h3u},
note={}
}

The Zenodo DOIs archive the code, not the paper: 10.5281/zenodo.23417132 is 0.4.2, the version the paper describes, with the run records behind its results, and 10.5281/zenodo.21619567 collects every release. CITATION.cff has the same details in machine-readable form.

Later releases correct two of the paper's results, detailed on the Benchmarks page: a harness bug understated featuretools, and fixing a search bug takes the datasets where beamfeat leads both tree ensembles from five to four.

Please also cite the statistical methods behind the options you use: Citing beamfeat lists which work goes with which option, with BibTeX.

License

MIT.

Metadata

Release files for beamfeat 0.7.0

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

Source distribution (sdist)

Source distribution for beamfeat 0.7.0
File Size Uploaded Provenance Actions
beamfeat-0.7.0.tar.gz 588.1 kB With provenance Details for beamfeat-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 735.9 kB

Release files / beamfeat-0.7.0.tar.gz

Download URL beamfeat-0.7.0.tar.gz
Size 588.1 kB
Tags Source
SHA-256 checksum
How to use checksums
908170ade22e6de92c1840f85de000f058313b229862b8e1de6e3fa7812366c8
BLAKE2b-256 checksum
How to use checksums
16892a262b922c670631ddbdc79a6b8826f796d6f3d3f5389cd1c304d9e68c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / beamfeat-0.7.0-py3-none-any.whl

Download URL beamfeat-0.7.0-py3-none-any.whl
Size 147.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7297b9a4fdde3c9f11145a7c37ff23cd300180ded1b29f18ed300aff558ad613
BLAKE2b-256 checksum
How to use checksums
3afae2df389b610022438f9f2399160b5b5176cfbb1af42cc3eef843d1ebd837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for beamfeat 0.7.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for beamfeat-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

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.

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