predict(model, X)


model is a dictionary of the specifications of a prediction model. It is generated by functions such as randomForestClassifier or randomForestRegressor.

X is a table. The column names must be the same as the column names in the table used to train the prediction model.


Make a prediction with the specified prediction model and data. The result is a vector with the same number of elements as the the number of rows in X. Each element of the vector corresponds to the predicted value of a row in X.


The following example uses the model generated by randomForestRegressor for prediction.

x1 = rand(100.0, 100)
x2 = rand(100.0, 100)
b0 = 6
b1 = 1
b2 = -2
err = norm(0, 10, 100)
y = b0 + b1 * x1 + b2 * x2 + err
t = table(x1, x2, y)
model = randomForestRegressor(sqlDS(<select * from t>), `y, `x1`x2)
yhat = predict(model, t);
// output

plot(y, yhat, ,SCATTER);