saveModel

Syntax

saveModel(model, location)

Arguments

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

location is a string indicating the absolute path and name of the output file.

Details

Save the specifications of a trained model to a file on disk.

Examples

$ 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)
$ saveModel(model, "C:/DolphinDB/Data/regressionModel.txt");