A Python library implementing Piecewise Specialist Symbolic Regression (PSSR), a two-phase evolutionary approach for symbolic regression that combines multiple specialist models through learned conditional routing.
PSSR is a piecewise function approximation method that extends traditional Genetic Programming (GP) by:
- Training Specialist Models: Evolves a population of GP individuals using lexicase selection, each specializing in different regions of the input space
- Evolving Ensemble Trees: Creates conditional routing trees that intelligently combine specialists based on learned conditions
The resulting model partitions the input space and routes inputs to appropriate specialist models, often achieving better performance than single GP models.
For more details and the original implementation, see my thesis.
- Python >= 3.11
- NumPy >= 2.3.4
- scikit-learn >= 1.7.2
- pandas >= 2.3.3
# Clone the repository
git clone https://github.com/yourusername/PSSR.git
cd PSSR
# Install in development mode
pip install -e .
# Or install with poetry
poetry installimport numpy as np
from pssr import PSSRegressor
# Generate sample data
np.random.seed(42)
X = np.random.randn(100, 2)
y = X[:, 0] + 2 * X[:, 1] + 0.1 * np.random.randn(100)
# Create and fit the model
model = PSSRegressor(
specialist_pop_size=50,
ensemble_pop_size=50,
random_state=42
)
model.fit(X, y, specialist_n_gen=50, ensemble_n_gen=50)
# Make predictions
predictions = model.predict(X)
print(f"R² Score: {model.score(X, y):.4f}")See CONTRIBUTING.md for guidelines on contributing to the project.
If you use PSSR in your research, please cite:
@mastersthesis{Amaral2025PSSR,
title = {Piecewise Symbolic Regression via Lexciase-Guided Specialist Ensembles},
author = {Amaral, Mateus Baptista},
advisor = {Vanneschi, Leonardo},
school = {NOVA Information Management School (NOVA IMS)},
year = {2025},
type = {Master's Thesis},
url = {http://hdl.handle.net/10362/190604}
}