Transformers

class derrom.transformers.ELM_features(ELM_nodes=200, ELM_weights_mean=0.0, ELM_weights_std=1.0, ELM_bias_low=-1.0, ELM_bias_high=1.0, seed=817, activation_function=<ufunc 'tanh'>)[source]

Bases: base_transformer

Extreme Learning Machine (ELM) features transformation.

Generates a feature vector, which concatenates the linear delay-embedded feature vector and the ELM transformation thereoff. The ELM transform can be understood as sinle-layer feed-forward network. The inputs are subject to random linear projection, which are then combined with a random bias and fed into a (nonlinear) activation function.

The weights of the random projection matrix are drawn from a normal distribution whose parameters can be specified. The elements of the bias vector are drawn from a uniform distribution whose parameters can be specified.

Parameters:

ELM_nodesint

Number of ELM nodes/neurons.

ELM_weights_meanfloat

Mean value for the randomly drawn projection weights.

ELM_weights_stdfloat

Standard deviation of the randomly drawn projection weights.

ELM_bias_lowfloat

Lower bound for the randomly drawn biases.

ELM_bias_highfloat

Upper bound for the randomly drawn biases.

seedint

Seed value for the random generator.

activation_functioncallable

Activation function for the ELM neurons. Must act element-wise on 1D numpy.ndarrays.

setup(n_DE_features)[source]

Generates the random projection matrix and the random bias vector and thereby defines the number of ELM nodes/neurons.

Note that the standard deviation of the randomly drawn projection matrix is scaled with the square root of number of ELM roots. This ensures that the mean input a neuron receives is of the order of one.

Parameters:

n_DE_featuresint

Number of delay embedded features, i.e., size the delay embedded feature vector. This is set by derrom’s fit method.

transform(DE_state_matrix)[source]

Carries out the ELM features transformation.

Parameters:

DE_state_matrix – 2D numpy.ndarray Delay embedded state matrix with the features in the rows, which is to be transformed. May only contain one row.

class derrom.transformers.base_transformer[source]

Bases: object

Base class to define the methods to be implemented.

setup()[source]
transform()[source]
class derrom.transformers.polynomial_features(order=2)[source]

Bases: base_transformer

Polynomial features transformation.

Generates a feature vector with all monomials up to the specified order/degree. This includes mixed monomials for orders > 1.

Notes:

  • The size of the resulting feature vector scales with the power of order/degree.

  • The generated features are not orthogonal.

  • Polynomial (opposed to monomial features) are constructed by the linear combination in the regression step.

  • The computation is implemented by iteratively computing the outer product (Tensor) product with the linear feature vector and then reshaping the resultung upper triangle (to avoid redundant features) back to a vector. Hence, more memory is allocated internally than one might infer from the resultung feature vector size.

  • The monomial features correspond the basis functions of a discrete Volterra series.

Parameters:

orderint

Polynomial degree, to which features are to be generated.

setup(n_DE_features)[source]

Not required for this transformation.

transform(DE_state_matrix)[source]

Carries out the polynomial features transformation.

Parameters:

DE_state_matrix – 2D numpy.ndarray Delay embedded state matrix with the features in the rows, which is to be transformed. May only contain one row.