Integration

Optiscorer is using REST API and the data format is provided in CSV or JSON. You should send files for model training and prediction in API usage. For example; For the training of your machine learning model, a file is placed in the “train_file” key in CSV format. The data set shown in Table-1 should be converted to csv format in Table-2 and sent.

The data set to be sent to the Optiscorer API for training and prediction methods, column name order should be sent by following the same order as in Table 3.

Hint : The first column of the data file you provide is always ID column and the last column of the training data set is always score you want to train (teach to machine). In the test file you provide the same column format as in the training set without the last column (the score column). The reason of missing the last column in the test is, predicting this column during the test phase.

Further information about methods is below:

Methods

Optiscorer Train

  1. optiscorer/train

for training the model

Method

URL

POST

sunucu_IP/optiscorer/train

 

Type

Key

Value

POST

train_file

file

Train veri seti

 

Response:

 

Type

Descriptive

json

“Done”

 

Optiscorer Predict

1. optiscorer/predict

 

Returns a test set for the test data from the trained model.

Rquirements: 1. A Trained model with the train method. 2. A test data set without the last column (the scores)

 

Request:

Method

URL

POST

sunucu_IP/optiscorer/predict

 

Type

Key

Value

POST

file

file

Skoru tahmin edilmesi istenilen veri seti

 

Response:

 

Type

Description

string

ID

integer

Score

 

2. optiscorer/predict_line

 

Returns the prediction score for a single line:

Requirements: 1. A trained model with the train method, 2. A test data line without the score

 

Request:

 

Method

URL

POST

sunucu_IP/optiscorer/predict_line

 

Type

Key

Value

POST

line

data

Skoru tahmin edilmesi istenilen veriler.

 

Response:

 

Type

Description

string

ID

integer

Score

 

Samples

CURL

1. optiscrorer/train

Request:

curl -X POST -F “train_file=@churn_train.csv” http://127.0.0.1:5000/optiscorer/train

Response:

“Done”

 

2. optiscrorer/predict

Request:

curl  -X POST   -F file=@”churn_predict.csv” http://127.0.0.1:5000/optiscorer/predict

 

Response:

{“8999”: 0.2546779407600896,

  “9000”: 0.0038931861612941827,

  “9001”: 0.3305867704110245,

  “9002”: 0.04050216968690639,

  “9003”: 0.22248843761573855,

  “9004”: 0.13911811329647242 }

 

3. optiscrorer/predict_line

 

Request:

curl \

-d ‘{“line”: “8999,15692577,Tomlinson,674,Germany,Female,38,10,83727.68,1,1,0,45418.12”}’ \

-H “Content-Type: application/json” \

 -X POST http://127.0.0.1:5000/optiscorer/predict_line

Response:

{“8999”: 0.2546779407600896 }

Postman

1. optiscrorer/train

 

Step by Step

  1. Select POST method

  2. Provide the  {server_ip}/optiscorer/train to the URL

  3. Click on body

  4. Click on Form_data

  5. Open File (When you hover the 5 as indicated in the screen shot below, the file will appear)

  6. Provide the key value of the data loaded for training themodel  as:  “train_file”

  7. Load the data for the model

  8. Send a request to OptiScorer Rest API

2. optiscrorer/predict

 

 

Adım Adım:

  1. Select POST as the method

  2. Provide the URL: {server_ip}/optiscorer/predict

  3. Click on Body

  4. Click on Form_data

  5. Open File (When you hover the 5 as indicated in the screen shot below, the file will appear)

  6. Provide the key value of the data loaded for test the model  as:  “file”

  7. Load the data for the model

  8. Send a request to OptiScorer Rest API

 

3. optiscrorer/predict_line

 

Step by Step

  1. Select POST as the method

  2. URL olarak {sunucu_ip}/optiscorer/predict_line içeren adresi yaz.

  3.  Provide the URL: {server_ip}/optiscorer/predict
  4. Click on Body
  5. Selecdt JSON(application/json)

  6. Provide “line” for the key and “csv” for the value of the json file you will load for the prediction.

  7. Send a request to OptiScorer Rest API

 

 

 

 

Bir cevap yazın

Your email address will not be published. Required fields are marked *

Post comment