<< Click to Display Table of Contents >> REST Experimental Design |
After the REST interface is configured, you need to design a REST experiment. You can learn about the establishment and precautions of the REST experiment through the following logistic regression case.
❖Test Connection and Save Test Data
1.Enter Advanced Analysis and create a new experiment model.
2.Connect REST request and response nodes.
3. Binding the data column through the service configuration. Here, enter the json format parameter in the test parameter code. For details, you can view the description of the body format in REST API Method Description, and test the connection between the request and response nodes. And save the settings to bind the columns. At this time, the bound columns can be processed in subsequent nodes of the requesting node. A total of 9 columns of int type independent variables and a column of boolean dependent variables are bound here, which can be seen in the following use.
❖The training set connection algorithm performs model training and exports the model
4. After entering the parameter code, you will return to the experiment. You can drag the logistic regression node in the classification algorithm under the algorithm node to connect to the training set, and set the parameters of the logistic regression algorithm in the configuration item on the right to get the model file .
Note: The columns used in the training set need to be consistent with the names and types of the columns bound to the REST request, otherwise an error will be reported during the final test.
In the above figure, the independent variable selects 9 columns of int type among the bound columns, and the dependent variable selects the y column of Boolean type.
5. The connection is saved as a training model node, and the experiment is run to obtain the trained model node, which is used to predict the REST request.
❖Apply model to predict REST request results
6. After getting the training model, drag the model to the canvas, connect the model application node in the verification and evaluation with the REST request node at the same time, and configure the configuration items of the model application node.
Note: The independent variables and dependent variables of the model application node are the data columns of the request node. The selection of the independent variables is required to be consistent with the order of the logistic regression node selection columns.
The target column in the above figure is the storage column of the prediction result. Here, a new column is added to store the prediction result when selecting data.
7. Disconnect the connection between the REST response and the request, connect to the model application, and right-click to run the application model node. After the operation is successful, it is proved that the parameter configuration is correct.
8. After running successfully, you can test the interface connectivity by opening the service configuration and clicking Test.
You can see the experimental results obtained in the above figure. The column named pre stores the predicted results. The result format is the return format of the interface. For details, please refer to the introduction of each method description in REST API Method Description.
9. Save the experiment. At this point, a simple logistic regression experiment is designed. Of course, in the actual use process, the model training process requires various adjustments to achieve the target results. The model training and the REST experiment can be divided into two independent experiments to complete.