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: .. code-block:: python 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 .. list-table:: :header-rows: 1 :widths: 45 55 * - GP-OLS MATLAB toolbox - ``eqdisco`` * - ``popu = gpols_init(popusize, maxtreedepth, symbols)`` - ``GPOLSRegressor(population_size=..., max_depth=..., functions=...)`` * - ``symbols`` (operators and terminals) - ``functions=``; terminals are the columns of ``X``, named by ``feature_names=`` * - ``gpols_evaluate(popu, ixv, X, Y, Q, opte)`` - ``fit(X, y)``; evaluation of every individual is internal * - ``opte(1:2)``, tree-size penalty - ``parsimony=``, ``max_genes=``, ``max_depth=``, ``model_selection=`` * - ``opte(3)``, OLS threshold (fraction or term count) - ``err_threshold=`` (fraction of explained variance) * - ``opte(4)``, polynomial evaluation - ``functions=("add", "mul")`` (the default) * - ``Q``, weighted least squares - not provided in version 1.0 * - ``gpols_mainloop`` - ``generations=``, ``patience=``, ``time_limit=`` * - ``gpols_result`` - ``equation_``, ``gene_table()``, ``history_``, ``pareto_front_`` * - lagged regressors built by hand - ``NARXRegressor(GPOLSRegressor(...), na=, nb=, nk=)`` * - — - ``backward_check=True``: removal of collinear terms * - — - ``err_guided=``: ERR-guided variation (new, experimental) * - — - ``CooperativeOLSRegressor``: a shared term library (new) Differences in behaviour ------------------------ * ``eqdisco`` estimates 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 :math:`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=False`` to 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"``); set ``model_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.