Overview
The Predictron Labs REST API allows you or your application to access certain features of the service. Most of the functions profived by the API are also available to use through the Predictron Labs web intarface.
Gain access
The API is currently in open alpha and free for all to use with certain limitation considering the type of subscription you choose. In order to use the API, you first need to register to obtain you USER_KEY. This key is used to authenticate your request.
Methods
Currently the PREDICTRONLABS API consists of six methods that can be called with the parameters described below. General parameters are the USER_KEY that is used to authenticate your request and an optional resouce key that identiy the resoure you want to use. The resource could be the PROJECT_KEY when you add evaluation of deployment dataset to the production branch or it might be a PREDICTRON_KEY that identifies a trained model in any branch of your project. For downloading results identification of the dataset using the DATASET_KEY might also be required.
Response
Each method of the API returns a JSON containing the following parameters:
RESPONSE | DESCRIPTION |
success | Boolean value {True,False that shows the success of the method invoked. |
message | When the success=False this field contains the description of the error |
dataset_id | Methods that stores a dataset returns the identifier of the dataset in the framework |
job_id | Methods invoking background processing returns the job identifier |
Adding new trainset
This API call provides an interface for model training. Based on the trainset uploaded the model will be trained automatically. To invoke this feature send the training dataset with POST request to the following URL:
http://api.predictronlabs.com:8080/train |
training_data | The HTTP file descriptior of the dataset to be uploaded |
user_key | USER_KEY |
project_key | PROJECT_KEY |
json_load | optional JSON content for taging |
The response of this API method is desribed at the standard API response section.
Example using curl:$curl -i -F training_data=@./DATASET \
-F project_key=PROJECT_KEY \
-F user_key=USER_KEY \
http://api.predictronlabs.com:8080/train
Deployment of a specific model
This API call provide interface for deployment of the selected model by sending a model compatible dataset.To invoke this feature send the dataset to be deployed with POST request to the following URL:
http://api.predictronlabs.com:8080/deploy |
deloyment_data | The HTTP file descriptior of the dataset to be uploaded |
user_key | USER_KEY |
predictron_key | PREDICTRON_KEY |
json_load | optional JSON content for taging |
The response of this API method is desribed at the standard API response section.
Example using curl:$curl -F deployment_data=@./DATASET \
-F predictron_key=PREDICTRON_KEY \
-F user_key=USER_KEY \
http://api.predictronlabs.com:8080/deploy
Deployment of model in production
This API call provides interface for deployment of the production model in the selected project. The compatible datasets uploaded will be added to the production branch and will be scored by the model selected for production. To invoke this feature send the dataset to be deployed with POST request to the following URL:
http://api.predictronlabs.com:8080/production-deploy |
deloyment_data | The HTTP file descriptior of the dataset to be uploaded |
user_key | USER_KEY |
project_key | PROJECT_KEY |
json_load | optional JSON content for taging |
The response of this API method is desribed at the standard API response section.
Example using curl:$curl -i -F deployment_data=@./DATASET \
-F project_key=PROJECT_KEY \
-F user_key=USER_KEY \
http://api.predictronlabs.com:8080/production-deploy
Evaluation of a specific model
This API call provides an interface to evaluate the selected model. The datasets uploaded needs to be a valid evaluation set and will be linked to the model selected. To invoke this feature send the dataset to be deployed with POST request to the following URL:
http://api.predictronlabs.com:8080/evaluate |
evaluation_data | The HTTP file descriptior of the dataset to be uploaded |
user_key | USER_KEY |
predictron_key | PREDICTRON_KEY |
json_load | arbitrary content in JSON format |
The response of this API method is desribed at the standard API response section.
Example using curl:$curl -i -F evaluation_data=@./DATASET \
-F predictron_key=PREDICTRON_KEY \
-F user_key=USER_KEY \
http://api.predictronlabs.com:8080/evaluate
Evaluation of model in production
This API call provides the interface for evaluatuion of the model in production in the selected project. The dataset uploaded needs to be a valid evaluation set and will be linked to the model in production. To invoke this feature send the dataset to be deployed with POST request to the following URL:
http://api.predictronlabs.com:8080/production-evaluate/ |
evaluation_data | The HTTP file descriptior of the dataset to be uploaded |
user_key | USER_KEY |
project_key | PROJECT_KEY |
json_load | arbitrary content in JSON format |
The response of this API method is desribed at the standard API response section.
Example using curl:
$curl -i -F deployment_data=@./DATASET \
-F project_key=PROJECT_KEY \
-F user_key=USER_KEY \
http://api.predictronlabs.com:8080/production-evaluate
Fetch processed dataset
This API call provides an interface for previously updated dataset after processing. When the dataset uploaded is not suitable for the purpose it was uploaded for, then this function can be used to get back the original dataset uploaded with identical content. When the dataset were suitable for its purpose (training,evaluation or deployment) some fields will be added to the dataset. In case of category and binary target variable the probability of each class value will be added with name prob_CLASSVALUE, while the prediction generated by the selected model will be added as _prediction.
To invoke this feature send a HTTP GET request to:
http://api.predictronlabs.com:8080/get_dataset |
with the following parameters
predictron_key | PREDICTRON_KEY |
user_key | USER_KEY |
dataset_key | DATASET_KEY |
mode | sample - to get randomly selected 100 observatons full_csv - to request the whole dataset in uncompressed CSV |
The response of this API call is the uncompressed dataset queried.
Example for getting a sample using curl:
$curl http://api.predictronlabs.com:8080/get_dataset \
-F user_key=USER_KEY \
-F dataset_key=DATASET_KEY \
-F predictron_key=PREDICTRON_KEY \
-F mode=sample