eqdisco.fitness.complexity#

eqdisco.fitness.complexity(expr, kind='size')[source]#

Complexity \(C(f)\) of an expression.

Parameters:
exprExpression
kind{“size”, “depth”, “weighted”, “recursive”, “n_params”, “n_variables”}
  • size – number of nodes \(|f|\);

  • depth – tree depth;

  • weighted – sum of the node weights (Primitive.complexity, 1 for leaves): nonlinear functions cost more;

  • recursive – the measure of Kommenda et al. (2015): constant 1, variable 2, \(+,-\) sum, \(\times,\div\) product of \((c_i+1)\), square \(c^2\), square root \(c^3\), \(\sin,\cos,\tan,\exp,\log\) \(2^{c}\);

  • n_params – number of parameters; n_variables – distinct inputs.

Examples using eqdisco.fitness.complexity#

The size of the search space and the meaning of complexity

The size of the search space and the meaning of complexity