make_time_shift_features#

fastcan.narx.make_time_shift_features(X, ids, **kwargs)#

Make time shift 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, 2)) – The unique id numbers of output features, which are (feature_idx, delay).

  • **kwargs (dict) – Additional keyword arguments to be passed to numpy.pad(). If not specified, the default is to pad with np.nan.

Returns:

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

Return type:

ndarray of shape (n_samples, n_outputs)

Examples

>>> from fastcan.narx import make_time_shift_features
>>> X = [[1, 2], [3, 4], [5, 6], [7, 8]]
>>> ids = [[0, 0], [0, 1], [1, 1]]
>>> make_time_shift_features(X, ids)
array([[ 1., nan, nan],
       [ 3.,  1.,  2.],
       [ 5.,  3.,  4.],
       [ 7.,  5.,  6.]])