This sample demonstrates how a model is generated out of a data set using the linear regression algorithm. The sample uses a data set to generate a model, which is divided into two sets for training and testing.
Download WSO2 Machine Learner, and start the server.
Building the sample
Execute the following command to download the source code of the product:
Executing the sample
Follow the steps below to execute the sample.
If you already executed a sample before, execute the following command to remove the databases created:
rm -rf repository/database/WSO2ML_DB.*
<ML_HOME>/samples/rest-api/linear-regression/directory using the CLI.
<ML_HOME>refers to the downloaded
product-mldirectory with the source code of the product.
- Execute the following command to execute the sample:
Output of the sample
Once the sample is successfully executed, you can obtain the following output.
By default, the sample generates the model in the
/tmp/directory of your machine. For example, the generated file is in the following format denoting the date and time when it was generated:
You can change the location where the output model file is saved, by defining the folder path of the required location for the value of the
locationelement in the
The sample executes the generated model on the
<ML_HOME>/samples/rest-api/linear-regression/prediction-testdata set, and it prints the value
]as the prediction result In the CLI logs.