Polynomial regression fits the target column to a polynomial expression of the predictor columns. The degree of the polynomial is specified as an input argument to the function.
REGRESS_POLY('options', predictor_field1, predictor_field2, [...,] target_field)
where:
Is a dictionary of advanced parameters that control the model attributes, enclosed in single quotation marks. Most of these parameters have a default value, so you can omit them from the request, if you want to use the default values. Even with no advanced parameters, the single quotation marks are required. The format of the advanced parameter dictionary is:
'{"parm_name1": "parm_value1", ... ,"parm_namei": "parm_valuei"}'
The following advanced parameters are supported:
Optional. Controls the terms that are generated in the polynomial equation. The default value is "no". Allowed values are:
Optional. Is a value between 0 and 1 that specifies the fraction of data used for training the model. The default value is "0.8".
Optional. Is a value between 0 and 1 that specifies the fraction of data used for testing the model. The default value is "0.2".
Optional. Is a grid consisting of comma-separated positive numbers to be used as L2-regularization strengths. The default value is "0,1,1,10". The optimal value is chosen by cross-validation.
Optional. Is the number of folds used for cross-validation. Suggested values are integers between "2" and "10". The default value is "4".
Numeric
Are at least two predictor field names.
Numeric
Is the target field.
The following request uses REGRESS_POLY to compute the predicted price using a polynomial regression of degree 4 and predictors height, horsepower, peak RPM, city MPG, and highway MPG.
TABLE FILE imports85 PRINT price COMPUTE predictedPrice/I5 = REGRESS_POLY('{"degree":"4"}', height, horsepower, peakRpm, cityMpg, highwayMpg, price); WHERE price LT 30000 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The partial output is shown in the following image.