Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Python client for Yhat (http://yhathq.com/)

Project Description

This is the connection to the Yhat API. If you’d like to read more, visit our docs.

Quickstart

You can download the example here , or clone the git repo.

$ git clone git@github.com:yhat/yhat-examples.git
$ cd beer-recommender

Insert your APIKEY and USERNAME and run the script.

$ python recommender.py
Deploy? (y/N): y
# {"status": "success"}

Overview

Usage

Installation

Using pip:

$ pip install --upgrade yhat

From source:

$ git clone git@github.com:yhat/yhat-client.git
$ cd yhat-client
$ python setup.py install

Setting up your model

Handling Input and Output

df to df

Specify df to df by decorating execute with the following:

from yhat import preprocess
# ...
# ...
@preprocess(in_type=pd.DataFrame, out_type=pd.DataFrame)
def execute(self, data)
# ...
# ...

Input

// making 1 prediction with an API call
{
  "column1": VALUE,
  "column2": VALUE
}
// making multiple predictions with 1 API call
{
  "column1": [ VALUE_1, VALUE_2 ]
  "column2": [ VALUE_1, VALUE_2 ]
}

Output

Data will come back with columns as keys and values as lists of values.

{
  "output_column1": [ VALUE_1 ],
  "output_column2": [ VALUE_1 ]
}

df to dict

from yhat import preprocess
# ...
# ...
@preprocess(in_type=pd.DataFrame, out_type=dict)
def execute(self, data)
# ...
# ...

Input

// making 1 prediction with an API call
{
  "column1": VALUE,
  "column2": VALUE
}
// making multiple predictions with 1 API call
{
  "column1": [ VALUE_1, VALUE_2 ]
  "column2": [ VALUE_1, VALUE_2 ]
}

Output

Selecting the dict output gives the user the ability to define their own output format (so long as it is a valid Python dictionary.

// this is valid
{
  "pred": 1
  "values": [1, 2, 3]
}
// this is also valid
{
  "x": {
    "y": 10
  "z": 100
  }
}

dict to dict

This is the most “free form” means of input and output. The user can send in any valid dictionary, process it how they like, and then return any valid dictionary .

from yhat import preprocess
# ...
# ...
@preprocess(in_type=dict, out_type=dict)
def execute(self, data)
# ...
# ...

Input

// this is valid
{
  "pred": 1
  "values": [1, 2, 3]
}
// this is also valid
{
  "x": {
    "y": 10
  },
    "z": 100
  }
}

Output

// this is valid
{
  "pred": 1
  "values": [1, 2, 3]
}
// this is also valid
{
  "x": {
    "y": 10
  },
    "z": 100
  }
}

Deploying

>>> yh.deploy("myExampleModel", MyExampleModel, globals())

Misc

Dependencies

Required

  • progressbar
  • pip
  • Flask
  • colorama
  • websocket-client
  • prettytable
  • dill

Highly suggested

  • pandas
  • sklearn

Analytics

Release history Release notifications

History Node

1.10.0

History Node

1.9.17

History Node

1.9.16

History Node

1.9.15

History Node

1.9.14

History Node

1.9.13

History Node

1.9.12

History Node

1.9.11

History Node

1.9.10

History Node

1.9.9

History Node

1.9.8

History Node

1.9.7

History Node

1.9.6

History Node

1.9.5

History Node

1.9.4

History Node

1.9.3

History Node

1.9.2

History Node

1.9.0

History Node

1.8.7

History Node

1.8.6

History Node

1.8.5

History Node

1.8.4

History Node

1.8.3

History Node

1.8.2

History Node

1.8.1

History Node

1.8.0

History Node

1.7.7

History Node

1.7.6

History Node

1.7.5

History Node

1.7.4

History Node

1.7.3

History Node

1.7.2

History Node

1.7.1

History Node

1.7.0

History Node

1.6.2

History Node

1.6.1

History Node

1.6.0

History Node

1.5.0

History Node

1.4.1

History Node

1.4.0

History Node

1.3.8

History Node

1.3.7

History Node

1.3.6

History Node

1.3.5

History Node

1.2.10

History Node

1.2.9

History Node

1.2.8

History Node

1.2.7

History Node

1.2.6

History Node

1.2.5

History Node

1.2.4

History Node

1.2.3

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.6

History Node

1.1.5

History Node

1.1.4

History Node

1.1.3

History Node

1.1.0

History Node

1.0.0

History Node

0.9.0

This version
History Node

0.8.1

History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.1

History Node

0.7.0

History Node

0.6.18

History Node

0.6.17

History Node

0.6.16

History Node

0.6.15

History Node

0.6.14

History Node

0.6.13

History Node

0.6.12

History Node

0.6.11

History Node

0.6.10

History Node

0.6.9

History Node

0.6.8

History Node

0.6.7

History Node

0.6.6

History Node

0.6.5

History Node

0.6.3

History Node

0.6.1

History Node

0.6.0

History Node

0.5.1

History Node

0.5.0

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.9

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

History Node

0.0.8

History Node

0.0.7

History Node

0.0.4

History Node

0.0.2

History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
yhat-0.8.1-py2.7.egg (44.5 kB) Copy SHA256 hash SHA256 Egg 2.7 May 30, 2014
yhat-0.8.1.tar.gz (17.5 kB) Copy SHA256 hash SHA256 Source None May 30, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page