Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EML-SR: Single-Operator Symbolic Regression

License: MIT Python 3.10+ JAX

eml-sr is a high-performance, scikit-learn compatible symbolic regression library. Unlike traditional symbolic regression tools that search over many mathematical primitives (such as $+$, $-$, $\sin$, $\cos$, $\exp$, etc.), eml-sr restricts the search space to a single universal base operator: the Exponential-Logarithmic EML operator:

$$eml(x, y) = e^x - \ln(y)$$

By recursively nesting this operator, the algorithm can represent any elementary function. This eliminates the combinatorial explosion of primitive sets, offering a mathematically clean formulation for discovering physical laws from data.


Key Features

  • Single-Operator Search Space: Restricts candidate expressions to nested EML topologies, bypassing the traditional combinatorial search bottle-neck.
  • Complex-Domain Stabilization: Evaluates EML branches in the complex domain ($\mathbb{C}$) to prevent program crashes when logarithmic arguments become negative. This enables trigonometric behaviors ($\sin$, $\cos$) to emerge naturally via Euler's identity.
  • Dimensional Annealing & 2D Pareto Sorting: Avoids multi-objective search dilution (3D Pareto collapse) by combining fit and unit consistency into a single fitness metric, scheduled dynamically using an annealing penalty.
  • JAX-Sniper Parameter Polishing: Compiles syntax trees into static XLA graphs for fast parameter optimization using JAX's automatic differentiation and L-BFGS-B.
  • Scikit-Learn API: Seamless EMLRegressor wrapper featuring pandas support, automated variable unit padding, and SymPy export.

Installation

Clone the repository and install the dependencies:

git clone https://github.com/Jotanune/EML-SR.git
cd EML-SR
pip install -e .

Note: For GPU acceleration and compiled optimization, ensure jax and jaxlib are installed in your environment.


Quickstart

The library is designed to fit into standard scientific Python workflows. Here is a simple example:

import numpy as np
from eml_sr import EMLRegressor

# Generate dummy physics dataset: y = 0.5 * k * x^2 (Harmonic Potential)
X_train = np.random.uniform(0.1, 2.0, (100, 2))  # [k, x]
y_train = 0.5 * X_train[:, 0] * (X_train[:, 1] ** 2)

# Define variable units (SI base vectors: [Length, Time, Mass, Temperature, Voltage])
# k (spring constant): [0, -2, 1, 0, 0] (kg/s^2)
# x (displacement): [1, 0, 0, 0, 0] (m)
units = [
    [0, -2, 1, 0, 0],
    [1, 0, 0, 0, 0]
]

# Initialize and fit the regressor
model = EMLRegressor(
    population=500,
    generations=150,
    dimensional_shield='annealing',
    jax_polish=True
)
model.fit(X_train, y_train, units=units)

# Predict on new data
y_pred = model.predict(X_train)

# Export the exact simplified mathematical expression
best_eq = model.get_best_equation()
print("Discovered Equation (SymPy):", best_eq)

Scientific Validation

We evaluated the performance of eml-sr on the 120 equations of the Feynman Symbolic Regression Benchmark. The ablation study shows the progression of our search architecture:

Milestone / Architecture Exact Successes Median Test RMSE RMSE < 0.25 Benchmark Time
1. Standard Memetic GP 8 0.6500 46 12.4 min
2. NSGA-II (3D Pareto) 6 0.9900 39 6.3 min
3. Parallel Titan (Soft 3D) 7 0.9209 38 120.9 min
4. Titan 2D Annealing 10 0.6503 46 16.9 min
5. Mega-Titán (Scale-up) 10 0.6173 48 130.0 min

Gaussian Rediscovery

Our engine exactly rediscovered the Gaussian probability density function ($I.6.2a$):

$$f(\theta) = \frac{e^{-\theta^2/2}}{\sqrt{2\pi}}$$

In its pure EML syntax tree representation, this function corresponds to a nested tree of exactly 41 EML operations:

eml(eml(eml(eml(1, eml(eml(1, eml(1, eml(eml(1, -0.5), 1))), 1)),
eml(eml(eml(1, eml(eml(1, eml(1, eml(eml(1, 1), 1))), 1)), eml(eml(1,
eml(eml(1, eml(eml(1, eml(eml(1, eml(1, eml(eml(1, theta), 1))), 1)),
eml(eml(eml(1, eml(eml(1, eml(1, eml(eml(1, 1), 1))), 1)), eml(eml(1,
eml(eml(1, theta), 1)), 1)), 1)), 1)), 1)), 1)), 1)), 1), 1)

References

  1. EML Theoretical Foundation: Andrzej Odrzywołek. All elementary functions from a single binary operator. arXiv preprint arXiv:2603.21852, 2026.
  2. Implementation Details: Javier Núñez Gallego-Albertos. Practical Single-Operator Symbolic Regression: Scaling the EML Framework with Dimensional Annealing and JAX. Technical Report, 2026. (See Nunez_EML_Symbolic_Regression_2026.pdf in the workspace).

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Python framework for stable symbolic regression with the EML operator

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages