This topic describes the random forest regression algorithm.
Random forest regression is an application branch of random forest. The random forest regression model establishes multiple unrelated decision trees by randomly selecting samples and features, and obtains prediction results in parallel. Each decision tree can draw a prediction result by using samples and features. The regression prediction result of the whole forest is obtained by averaging the results of all trees.
Random forest regression can be used in the scenario which requires tens of data dimensions and high accuracy.
For example, the random forest regression model can be used to predict the popularity of a topic on Twitter. The input of the model can be the features of the topic, such as the number of discussion groups for the topic, the number of persons discussing the topic, and the attention of the topic. The output of the model is the average number of active discussion groups per hour. This is a positive floating point number to indicate the popularity.
The parameters in the following table are the values of the
model_parameter parameters in the
CREATE MODEL statement for creating a model. You can select the values based on your needs.
|n_estimators||The number of iterations. A higher number of iterations indicates a better fitting. It is usually a positive integer. The default value is 100.|
|objective||The learning task and its learning objectives. Default value: mse. Valid values:|
|max_features||The maximum number of features to consider when deciding the partition. Default value: sqrt. Valid values:|
|random_state||The random state. This parameter is usually a positive integer. Default value: 1.|
|n_jobs||The number of parallel threads. A large number indicates a high training speed. This parameter is usually a positive integer. Default value: 4.|
|max_depth||The maximum depth of each tree. This parameter is usually a positive integer. Default value: None. |
Note If this parameter is set to None, the depth of the tree is not specified.
/*polar4ai*/ CREATE MODEL randomforestreg1 WITH ( model_class = 'randomforestreg', x_cols = 'dx1,dx2', y_cols='y', model_parameter=(objective='mse')) AS (select * from db4ai.testdata1)
/*polar4ai*/ select dx1,dx2 FROM PREDICT(MODEL randomforestreg1, select * from db4ai.testdata1 limit 10) WITH (x_cols = 'dx1,dx2', y_cols='')
y_colsmust use floating-point or integer data.