LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Softwarekeplearnsymbolic-regressionrustopen-sourcephysics

Keplearn, a Free Rust Tool Named for Kepler, Reads a Table of Measurements and Prints the Equation Behind It, Gravity Included

Keplearn is an MIT-licensed symbolic regression program that takes columns of numbers, searches for the compact formula linking them, and on SRBench's 116 Feynman physics equations reports solving 75 exactly.

Chris Pirillo at a round wooden table sliding a ruled sheet of measurements toward a brass orrery whose planets swing on elliptical arms
Illustration: LockerGnome

The name is the pitch. “Keplearn is named after Johannes Kepler, who deduced his laws of planetary motion by studying tables of astronomical observations taken by Tycho Brahe,” the README says. “That is what this program attempts to do: given columns of measurements, find the compact law that relates them.”

Kepler really did work that way. His first law, that planets move in ellipses, came “by analyzing the astronomical observations of Tycho Brahe” and appeared in his Astronomia nova in 1609, according to Wikipedia’s account of the laws. The third law followed in 1619. Newton’s law of gravitation, the one Keplearn’s sample spits out, came in 1687.

The program is the work of Chandler Freeman, who publishes it under the GitHub name owls-on-wires. The first release, v0.1.0, went up September 13, with prebuilt downloads for macOS, Windows and Linux. The README calls it a “deterministic symbolic regression engine (written in Rust) that recovers closed-form equations from tabular data by best-first recursive reduction.”

In plain terms: most curve fitting starts with you choosing the shape of the equation and asks the computer for the numbers. Symbolic regression asks the computer for the shape too. Keplearn tries to explain the target column by peeling it apart step by step, dividing out a factor or undoing a transform, until what’s left is simple enough to fit exactly.

Using it is one line. You hand it a TSV or CSV on standard input and name the column with --target, and it answers with JSON. The README’s run on a gravity file returns the model ((x1*x2)*((x3)**(-2))), an r2 of exactly 1, and "stopped_by": "exact_exit", in a reported 0 milliseconds.

The benchmark numbers come from the author, and he says so. When Freeman added Keplearn to SRBench, the standard comparison suite for symbolic regression, in a pull request merged September 21, he labeled them “Self-reported results,” run at “a 60 second per-fit cap” that is “well under the official 3600 s / 36000 s settings.”

With clean data, those results are strong, and with noisy data they drop fast:

SRBench suite (self-reported) Result
Feynman, 116 equations, no noise 75 solved exactly (64.7%)
Feynman, noise 0.001 65 (56.0%)
Feynman, noise 0.1 10 (8.6%)
Black-box, 138 datasets median test R2 about -0.003
Feynman fit time, no noise median 1.3 s; 55 of 116 under 1 s

The README puts the Feynman number in context: “The highest published Feynman symbolic rate on SRBench is AIFeynman at 55.8%.” It’s just as plain about the black-box result, the real-world data with no hidden formula: “Keplearn targets exact analytic laws rather than general curve fitting, and that result reflects the trade-off.”

There’s one more limit, and it’s in the pull request instead of the README. Inside SRBench’s harness, “Datasets with fewer than 40 rows return the constant model ‘0’,” because the internal holdout check “abstains rather than guess.”

Tools like this are most likely to show up as a first pass in science and engineering work, run on a table before anyone reaches for a neural network. If a clean formula falls out in a second, you’ve saved a training run; if it doesn’t, you’ve learned the data isn’t that simple. What the benchmarks don’t show yet is how Keplearn does at SRBench’s full time budget, which its author didn’t run.

More Software

Every Software story →