From the GP-OLS MATLAB toolbox#
The GP-OLS MATLAB toolbox (abonyilab.com/gp_index)
accompanies the paper of Madár, Abonyi and Szeifert (2005). A program built on it
initializes a population with gpols_init, evaluates it with gpols_evaluate
(which estimates the linear parameters, prunes subtrees by orthogonal least
squares and computes the fitness), repeats gpols_mainloop for the generations,
and prints the result with the gpols_result script. In eqdisco the whole
program is one estimator:
import eqdisco as eq
model = eq.GPOLSRegressor(
population_size=50, # popusize of gpols_init
max_depth=5, # maxtreedepth of gpols_init
functions=("add", "mul"), # the operator symbols; terminals are the columns of X
err_threshold=0.02, # opte(3), the OLS threshold
generations=30, # the number of gpols_mainloop calls
random_state=0,
).fit(X, y)
print(model.equation_) # gpols_result: the best equation
print(model.gene_table()) # terms, weights and error reduction ratios
GP-OLS MATLAB toolbox |
|
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
not provided in version 1.0 |
|
|
|
|
lagged regressors built by hand |
|
— |
|
— |
|
— |
|
Differences in behaviour#
eqdiscoestimates the weights of the terms with an intercept and a tiny ridge term (ridge=1e-8), so that duplicated or constant terms do not make the least-squares problem singular.The error reduction ratios are computed on centred data, so that they sum to the coefficient of determination \(R^2\) of the model.
After the forward OLS pruning, the backward check removes terms whose unique contribution is below the threshold; set
backward_check=Falseto reproduce the original pruning.The selected model is the one with the smallest Bayesian information criterion on the Pareto front of accuracy and size (
model_selection="bic"); setmodel_selection="best"for the most accurate individual, as in the toolbox.For dynamic models the identification is followed by a free-run simulation (
NARXRegressor.simulate), the validation recommended in the paper.