make_poly_ids#
- fastcan.narx.make_poly_ids(n_features=1, degree=1, max_poly=None, random_state=None)#
Generate ids for polynomial features. (variable_index, variable_index, …) variable_index starts from 0, and -1 represents constant.
- Parameters:
n_features (int, default=1) – The number of input features.
degree (int, default=1) – The maximum degree of polynomial features.
max_poly (int, default=None) – Maximum number of ids of polynomial features to generate. Randomly selected by reservoir sampling. If None, all possible ids are returned.
random_state (int or RandomState instance, default=None) – Used when max_poly is not None to subsample ids of polynomial features. See Glossary for details.
- Returns:
ids – The unique id numbers of output features.
- Return type:
array-like of shape (n_outputs, degree)
Examples
>>> from fastcan.narx import make_poly_ids >>> make_poly_ids(2, degree=3) array([[-1, -1, 0], [-1, -1, 1], [-1, 0, 0], [-1, 0, 1], [-1, 1, 1], [ 0, 0, 0], [ 0, 0, 1], [ 0, 1, 1], [ 1, 1, 1]])