polyfeatures

Generates polynomial features of specified degree.

Syntax

[X_poly,parameters] = polyfeatures(X,degree)

Inputs

X
Input data to be polyfeaturesd.
Type: double
Dimension: matrix
threshold
Threshold value above which are changed to 1 and below are changed to 0.
Type: double
Dimension: scalar

Outputs

X_poly
Polynomial input features of specified degree.
Type: integer
Dimension: matrix
parameters
Struct containing containing degree used for polynomial feature generation.
degree: degree used for polynomial feature generation.
Type: integer
Dimension: struct

Example

Usage of polyfeatures

X = [0 1;
     2 3;
     4 5];
	 
[X_poly, parameters] = polyfeatures(X, 3)
> X_poly
X_poly = [Matrix] 3 x 9
0 1 0 0 1 0 0 0 1
2 3 4 6 9 8 12 18 27
4 5 16 20 25 64 80 100 125
> parameters
parameters = struct [
   degree: 3
   model_name: model_16353133967574317
]

Comments

Output 'parameters' can be used by polyfeaturestransform function.