rforest

Returns the predicted target using the Random Forest modeling (a way of training an ensemble of decision trees).

Syntax

Predict using a stored training model.

rforest [size=INT] model=MODEL

Predict using a model trained based on subquery results.

rforest [size=INT] target=TARGET_FILED FIELD, ... [ SUBQUERY ]
Required Parameter
FIELD, ...
Fields as predictor variables for the Random Forest modeling.
model=MODEL
Name of the Random Forest model. You can generate and train the Random Forest model by connecting to the Logpresso engine via CLI.
target=TARGET_FIELD
Field as a target variable for the Random Forest modeling.
[ SUBQUERY ]
Subquery that returns the data set for model training.
Optional Parameter
size=INT
Number of trees within the random forest (default: 100)

Description

This command returns the predicted value of the target field into the _guess field.

Usages

  1. Predict using the rforest_titanic model.

    # Download: https://raw.githubusercontent.com/logpresso/dataset/main/titanic/train.csv
    table titanic_test
    | rforest model=rforest_titanic
    | eval _guess = if(_guess=="0", "사망 ", "생존")
    
  2. Predict using a model trained based on the training data set returned from a subquery.

    table titanic_test
    | rforest target=Survived Pclass, Sex, Age, Fare, Embarked
        [ csvfile /test/train.csv
          | eval Age=double(Age), 
            Fare=double(Fare), CanbinLetter=nvl(substr(Cabin, 0, 1), "--"), 
            TicketType=if(isnull(long(Ticket)), substr (Ticket, 0, indexof(Ticket, " ")), "--")
          | rex field=Name ", (?<Title>[^.]+)" 
          | eval Survived = if(Survived=="0", " 사망 ", "생존")
        ]