make_poly_features#

fastcan.narx.make_poly_features(X, ids)#

Make polynomial features.

Parameters:
  • X (array-like of shape (n_samples, n_features)) – The data to transform, column by column.

  • ids (array-like of shape (n_outputs, degree)) – The unique id numbers of output features, which are formed of non-negative int values.

Returns:

out.T – The matrix of features, where n_outputs is the number of polynomial features generated from the combination of inputs.

Return type:

ndarray of shape (n_samples, n_outputs)

Examples

>>> from fastcan.narx import make_poly_features
>>> X = [[1, 2], [3, 4], [5, 6], [7, 8]]
>>> ids = [[-1, -1], [-1, 0], [0, 0], [-1, 1]]
>>> make_poly_features(X, ids)
array([[ 1.,  1.,  1.,  2.],
       [ 1.,  3.,  9.,  4.],
       [ 1.,  5., 25.,  6.],
       [ 1.,  7., 49.,  8.]])