RF_CLASSIFIER
Trains a random forest model for classification on an input relation.
Syntax
RF_CLASSIFIER ( '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 |
Identifies the model stored as a result of the 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 |
| response‑column |
A CHAR or VARCHAR 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 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 randomly chosen features from which to pick the best feature to split on a given tree node, an integer Default Value: Square root of 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: 1 |
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_CLASSIFIER ('myRFModel', 'iris', 'Species', 'Sepal_Length, Sepal_Width,
Petal_Length, Petal_Width' USING PARAMETERS ntree=100, sampling_size=0.3);
RF_CLASSIFIER -------------------------------------------------- Finished training (1 row)