QDpy
Loading...
Searching...
No Matches
_residual.py File Reference

Diversified residual symbolic regression with robust coefficient search. More...

Go to the source code of this file.

Classes

class  qdpy.symbolic._residual.ResidualSymbolicElite
 A raw expression structure and one measured choice of node coefficients. More...
class  qdpy.symbolic._residual.ResidualSymbolicStats
 Count generated structures, actual coefficient trials, and archive updates. More...
class  qdpy.symbolic._residual.ResidualSymbolicResult
 Return measured models, cluster labels, and the native archive. More...
class  qdpy.symbolic._residual._ResidualPool
class  qdpy.symbolic._residual._ResidualSearch

Namespaces

namespace  qdpy

Functions

 qdpy.symbolic._residual.residual_symbolic_regression (X, y, *, groups=None, clusters=4, loss="medae", layout="residual", budget=128, fit_evaluations=25, max_fit_evaluations=None, max_depth=4, max_nodes=12, operators=("add", "sub", "mul", "div", "log", "exp"), literals=(1.,), coefficient_bounds=(-12., 12.), fit_sigma=.6, cma_population=6, initial_expressions=(), seed=0)
 Evolve expression structures and retain robust fits in distinct residual niches.

Detailed Description

Diversified residual symbolic regression with robust coefficient search.

See also
https://doi.org/10.1145/3795095.3805087

Definition in file _residual.py.

Function Documentation

◆ residual_symbolic_regression()

qdpy.symbolic._residual.residual_symbolic_regression ( X,
y,
* ,
groups = None,
clusters = 4,
loss = "medae",
layout = "residual",
budget = 128,
fit_evaluations = 25,
max_fit_evaluations = None,
max_depth = 4,
max_nodes = 12,
operators = ("add", "sub", "mul", "div", "log", "exp"),
literals = (1.,),
coefficient_bounds = (-12., 12.),
fit_sigma = .6,
cma_population = 6,
initial_expressions = (),
seed = 0 )

Evolve expression structures and retain robust fits in distinct residual niches.

Parameters
XFinite (samples, variables) training data.
yOne finite regression target per training row.
groupsOptional integer label per row, or None to cluster the scaled training data.
clustersK-means cluster count when group labels are absent.
lossUse median absolute error (medae), mean absolute error (mae), or root mean squared error (rmse).
layoutUse residual niches or a structural-only control.
budgetHard cap on expression proposals, including repeats.
fit_evaluationsMaximum coefficient trials per proposal, including the initial setting.
max_fit_evaluationsOptional additional hard cap on coefficient trials over the whole run.
max_depthMaximum depth in edges of the raw expression tree.
max_nodesMaximum number of raw tree nodes.
operatorsOperation names available to the tree grammar.
literalsNumeric constants available to the tree grammar.
coefficient_boundsCommon finite interval for node weights.
fit_sigmaInitial CMA-ES standard deviation.
cma_populationCoefficient trials per complete CMA-ES generation.
initial_expressionsRaw seed trees evaluated before genetic variation.
seedSeed for genetic variation, clustering, and coefficient search.
Returns
Measured residual niches and the cost of finding them.
Run DRSR on labeled training data with an optional structural control.

The archive indexes the group with highest mean absolute error,
raw tree size, and raw non-algebraic operator count. With
``layout="structural"``, the same search drops the group axis from
competition. Choose ``mae``, ``medae`` (median absolute error) or
``rmse`` as the optimization loss. The model's RMSE is recorded
independently. If supplied, the rows' integer group labels take
precedence over the default k-means clustering of scaled X and y.

Each raw tree gains one multiplicative weight per node. Constant
folding reuses the native expression evaluator. Bounded CMA-ES
trials require the existing ``cma`` extra. Undefined predictions
consume a trial. Every finite trial can enter the archive, including
lower-ranked coefficients that represent a different residual niche.

Definition at line 188 of file _residual.py.