Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Introduction

This sample demonstrates how a model is generated out of a data set using the decision tree algorithm. The sample uses a data set to generate a model, which is divided into two sets for training and testing.

Prerequisites

Download WSO2 Machine Learner, and start the server. 

Building the sample

Execute the following command to download the source code of the product: git clone https://github.com/wso2/product-ml.git

Executing the sample

Once the sample is successfully executed, you can obtain the following output.

  1. Follow the steps below if you already executed a sample before.

    • Execute the following command to remove the databases created:  rm -rf repository/database/WSO2ML_DB.*
    • Navigate to <ML_HOME>/bin/ directory.
    • Restart the WSO2 ML server by executing the following command: ./wso2server.sh -Dsetup 
  2. Navigate to <ML_HOME>/samples/rest-api/decision-tree/ directory using the CLI.

    <ML_HOME> refers to the downloaded product-ml directory with the source code of the product

  3. Execute the following command to execute the sample: sh model-generation.sh

Output of the sample

 Once the sample is successfully executed, you can obtain the following output.

  1. 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:  model.1.2015-03-20_13:29:10

    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 location element in the <ML_HOME>/samples/rest-api/decision-tree/create-model-storage file as shown below.

    {
    "type" : "file",
    "location" : "/tmp"
    }
  2. The sample executes the generated model on the  <ML_HOME>/samples/rest-api/decision-tree/prediction-test data set, and it prints the value [ 0.0] as the prediction result In the CLI logs.

  • No labels