LINEAR_REG
Executes linear regression on an input table or view. The result is a linear regression model.
Important: Before using a machine learning function, be aware that all the ongoing transactions might be committed.
Syntax
LINEAR_REG ( 'model_name', 'input_relation', 'response_column', 'predictor_columns' [ USING PARAMETERS[exclude_columns='col1, col2, ... coln',] [optimizer='value',] [epsilon=value,] [max_iterations=value,] [regularization= 'value',] [lambda= value] ])
Arguments
model_name |
The name of the linear regression model. You can use the resulting model for prediction with the PREDICT_LINEAR_REG function. Model names are case insensitive. |
input_relation |
The table or view that contains the training data for building the model. |
response_column |
The name of the column in the For the model to be valid, all values in this column must be of type numeric. |
predictor_columns |
A comma-separated list of the columns in the For the model to be valid, all values in this column must be of type numeric. Supports the use of wildcard (*) characters in place of column names. If you use a wildcard character (*) in place of a column name, all the columns in |
Parameters
exclude_columns=col1, col2, ... coln |
(Optional) The columns from |
optimizer=value |
(Optional) The optimizer method used to train the model. Valid Values:
|
epsilon=value |
(Optional) Determines whether the algorithm has reached the specified accuracy result. Default Value: 1e-6 |
max_iterations=value |
(Optional) Determines the maximum number of iterations the algorithm performs before achieving the specified accuracy result. Default Value: 100 |
regularization=value |
(Optional) Determines the method of regularization. Default Value: None Valid Values:
|
lambda=value |
(Optional) The regularization parameter value. The value must be zero or positive. Default Value: 0.0 |
Privileges
To use LINEAR_REG, you must either be a superuser or have CREATE privileges for the schema of the output view and SELECT privileges for the input table or view. There are no privileges needed on the function itself.
See GRANT (Schema) and GRANT (Table).
Examples
This example shows how you can use the LINEAR_REG function.
=> SELECT LINEAR_REG('myLinearRegModel', 'faithful', 'eruptions', 'waiting' USING PARAMETERS optimizer='BFGS'); LINEAR_REG ---------------------------- Finished in 10 iterations (1 row)