Skip to content

Latest commit

 

History

History
86 lines (69 loc) · 2.56 KB

File metadata and controls

86 lines (69 loc) · 2.56 KB
copyright
years
2016, 2017
lastupdated 2017-11-16

{:new_window: target="_blank"} {:shortdesc: .shortdesc} {:screen: .screen} {:codeblock: .codeblock} {:pre: .pre}

Scoring with a deployed predictive model

You can use the {{site.data.keyword.pm_full}} service to post the input data to use by the deployed model through the use of an API call. You can use this method to generate and return the predictive analytics in the score results. {: shortdesc}

POST http://{PA Bluemix load balancer
URL}/pm/v1/score/{contextId}?accesskey={access_key for this bound
application}

{: codeblock}

Request example:

    Content-Type: application/json;charset=UTF-8
    Parameters:
        Path parameters:
            contextId: the identifier of the deployed model to use to process this score request
        Query Parameters:
            accesskey: access_key from env.VCAP_SERVICES
        Body: the input data, json string, eg.
            {
                "tablename":"DRUG1n.sav", 
                "header":["Age", "Sex", "BP", "Cholesterol", "Na", "K", "Drug"], 
                "data":[[43.0, "M", "LOW", "NORMAL", 0.526102, 0.027164, "drugY"]]
            }   

{: codeblock}

Example of a successful response to the previous request:

    Content-Type: application/json;charset=UTF-8
    Status code: 200
    body: the score result, a json array, eg.
        [
            {
                "header":["Age","Sex","BP","Cholesterol","Na""K","Drug","$N-Drug","$NC-Drug"], 
                "data":[[23.0,"M","NORMAL","NORMAL",0.78452,0.055959,"drugX","drugX",0.9892564426956728]]
            }
        ]

{: codeblock}

Response when scoring request fails:

    Content-Type: application/json
    Status code: 200
    body:
        {
           "flag":false, 
           "message":"reason"
        }  

{: codeblock}

Learn more

Ready to get started? To create an instance of a service or bind an application, see Using the service with Spark and Python models or Using the service with IBM® SPSS® models.

For more information about the API, see Service API for Spark and Python models or Service API for IBM® SPSS® models.

For more information about IBM® SPSS® Modeler and the modeling algorithms it provides, see IBM Knowledge Center.

For more information about IBM Data Science Experience and the modeling algorithms it provides, see https://datascience.ibm.com.