RF_REGRESSOR

Trains a random forest model for regression on an input relation.

Syntax

RF_REGRESSOR ( 'model‑name', input‑relation, 'response‑column', 'predictor‑columns'                                                          
             [ USING PARAMETERS [exclude_columns='excluded‑columns'] 
                                [, ntree=num‑trees]
                                [, mtry=num‑features]
                                [, sampling_size=sampling‑size]
                                [, max_depth=depth]
                                [, max_breadth=breadth]
                                [, min_leaf_size=leaf_size]
                                [, min_info_gain=threshold]
                                [, nbins=num‑bins] ] )

Arguments

model‑name

The model that is stored as a result of training, where model‑name conforms to conventions described in Identifiers. It must also be unique among all names of sequences, tables, projections, views, and models within the same schema.

input‑relation

The table or view that contains the training samples. If the input relation is defined in Hive, use SYNC_WITH_HCATALOG_SCHEMA to sync the hcatalog schema, and then run the machine learning function.

response‑column

A FLOAT or INTEGER column in the input relation that represents the dependent variable.

predictor‑columns

Comma-separated list of columns in the input relation that represent independent variables for the model, or asterisk (*) to select all columns. If you select all columns, the argument list for parameter exclude_columns must include response‑column, and any columns that are invalid as predictor columns.

All predictor columns must be of data type CHAR, VARCHAR, BOOLEAN, INTEGER, or FLOAT; otherwise the model is invalid. CHAR, VARCHAR and BOOLEAN are treated as categorical data types. All other data types are treated as numeric data types.

Parameter Settings

Parameter name Set to…
exclude_columns

Comma-separated list of columns from predictor‑columns to exclude from processing.

ntree

The number of trees in the forest, an integer between 0 and 1000, inclusive.

Default Value: 20

mtry

The number of features to consider at the split of a tree node, an integer number‑predictors.

Default Value: one-third the total number of predictors

sampling_size

The portion of the input data set that is randomly picked for training each tree, a FLOAT between 0.0 and 1.0, inclusive.

Default Value: 0.632

max_depth

The maximum depth for growing each tree, an integer between 1 and 100, inclusive.

Default Value: 5

max_breadth

The maximum number of leaf nodes a tree in the forest can have, an integer between 1 and 1e9, inclusive.

Default Value: 32

min_leaf_size

The minimum number of samples each branch must have after splitting a node, an integer between 1 and 1e6, inclusive. A split that causes fewer remaining samples is discarded.

Default Value: 5

min_info_gain

The minimum threshold for including a split, a FLOAT between 0.0 and 1.0, inclusive. A split with information gain less than this threshold is discarded.

Default Value: 0.0

nbins

The number of bins to use for continuous features, an integer between 2 and 1000, inclusive.

Default Value: 32

Examples

=> SELECT RF_REGRESSOR ('myRFRegressorModel', 'mtcars', 'carb', 'mpg, cyl, hp, drat, wt' USING PARAMETERS
ntree=100, sampling_size=0.3);
RF_REGRESSOR
--------------
Finished
(1 row)

See Also