Skip to content

Latest commit

 

History

History
95 lines (68 loc) · 1.88 KB

File metadata and controls

95 lines (68 loc) · 1.88 KB
layout default
title OAuth REST API for Prediction

Seldon REST API for Prediction

The Seldon prediction REST API has a single endpoint which injest arbitrary JSON objects representing feature data to be used to train a model

  • Events : Arbitrary JSON representing some event from which we want to create a prediction model

Use the relevant API endpoint to provide predictions

An API method can be called with the following template {% highlight http %} [GET|POST] /endpoint?oauth_token=t {% endhighlight %}

For security reasons using the HTTPS protocol is recommended.

Events

Events allow input into Seldon of arbitrary events from which we wish to create a predictive model.

{% highlight http %} POST /events {% endhighlight %}

Example

The service injects house price data

{% highlight json %} { "num_bedrooms" : 2, "detached" : true, "postcode" : "SW1", "price" : 400000 } {% endhighlight %}

Prediction (Classification)

{% highlight http %} POST /predict {% endhighlight %}

The endpoint should be passed JSON containing features from which a prediction is to be made.

A request can have two parts

  • meta : optional meta data associated with the prediction request
  • data : features for the prediction request

The meta data can at present just contain a provided optional prediction id "puid".

Example

A housing price predictor based on features:

{% highlight json %} { "meta" : { "puid" : 1 }, "data": { "num_bedrooms" : 2, "detached" : true, "postcode" : "SW1" } } {% endhighlight %}

Output

{% highlight json %} { "meta": { "puid": "1", "modelName": "model_prices", "variation": "default" }, "predictions": [ {"prediction":400000,"predictedClass":"1","confidence":1.0} ] } {% endhighlight %}