eqdisco.expr.PrimitiveSet#

class eqdisco.expr.PrimitiveSet(n_features, functions=('add', 'sub', 'mul', 'div', 'sin', 'cos', 'exp', 'log', 'sqrt', 'square'), feature_names=None, p_constant=0.2, const_range=(-5.0, 5.0), function_weights=None, integer_constants=False, variable_weights=None)[source]#

Bases: object

Function and terminal sets of a search.

Parameters:
n_featuresint

Number of input variables \(n\).

functionssequence of str or Primitive

Function set \(\mathcal{F}\); names refer to PRIMITIVES.

feature_namessequence of str, optional

Variable names (default x0, x1, ...).

p_constantfloat

Probability that a random terminal is a constant rather than a variable.

const_rangetuple of float

Interval of the uniform distribution of new constants.

function_weightssequence of float, optional

Relative probabilities of drawing each function.

integer_constantsbool

Draw integer constants (useful for exact recovery benchmarks).