This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

The purpose of the Dato Predictive Service Python Client library is to allow Python applications to easily query Dato Predictive Services.

Installation

To install Dato Predictive Service Python Client, simply:

sudo pip install dato-predictive-service-client

or from source:

sudo python setup.py install

Requirements

  • Dato Predictive Service, launched by GraphLab-Create >= 1.4 installation

Usage

Create Client

To use the Dato Predictive Service Python Client, first you need to obtain the following information from a running Dato Predictive Service:

  • Predictive Service CNAME or DNS name (endpoint)
  • API key from the Predictive Service

Once you have obtained the above information, simply create a new PredictiveServiceClient:

from dato.deploy import PredictiveServiceClient;

client = PredictiveServiceClient(endpoint = <endpoint>,
                                api_key = <api_key>,
                                should_verify_certificate = <True-or-False>)

To enable SSL certificate verification for this Predictive Service, set the should_verify_certificate to true. However, if your Predictive Service is launched with a self-signed certificate or without certificate, please set should_verify_certificate to false.

The PredictiveServiceClient can also be created by using a Predictive Service client configuration file.

client = PredictiveServiceClient(config_file = <path_to_file>)

Query

To query a model that is deployed on the Predictive Service, you will need:

  • model name
  • method to query (recommend, predict, query, etc.)
  • data used to query against the model

For example, the code below demonstrates how to query a recommender model, named rec, for recommendations for user `Jacob Smith`:

data = {'users': ['Jacob Smith'] }
result = client.query('rec', method = 'recommend', data = data)

Notes

  • Different models could support different query methods (recommend, predict, query, etc.) and different syntax and format for data. You will need to know the supported methods and query data format before querying the model.

Set timeout

To change the request timeout when querying the Predictive Service, use the following:

# set timeout to 5 seconds.
client.set_query_timeout(timeout = 5)

The default timeout is 10 seconds.

Results

The output to the query() function is a dictionary of the query result.

If query is successful, the query result contains:

  • model response
  • uuid for this query
  • version of the model
model_response = result['response']
uuid = result['uuid']
version = result['version']

model_response contains the actual model output from your query.

Send feedback

Once you get the query result, you can submit feedback data corresponding to this query back to the Predictive Service. This feedback data can be used for evaluating your current model and training future models.

To submit feedback data corresponding to a particular query, you will need the UUID of the query. The UUID can be easily obtained from the query result.

uuid = result['uuid']

For the feedback data, you can use any attributes or value pairs that you like.

Example:

feedback_data = dict()
feedback_data['num_of_clicks'] = 3
feedback_data['searched_terms'] = 'test'

Now we can send this feedback data to the Predictive Service to associate this feedback with a particular query.

client.feedback(uuid, feedback_data);

More Info

For more information about the Dato Predictive Service, please read the API docs and userguide.

License

The Dato Predictive Service Python Client is provided under the 3-clause BSD license.

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dato-predictive-service-client-1.0.0.tar.gz (6.5 kB) Copy SHA256 Checksum SHA256 Source May 19, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting