YHatHQ API: Calling Hosted Statistical Models

The ŷhat Cloud Toolbox is a suite of development tools for integrating predictive analytics into existing Web and mobile applications. ŷhat deploys your models as RESTful APIs, so there's no need to port, translate, or adapt models for Integration with existing systems. It is currently in beta testing and an invite only stage. You can request an invite here.

ŷhat supports most regression and classification algorithms in popular scientific projects like scikit-learn and Statsmodels. There is just a two step procedure to start using it.

The use cases that are included are -

  • Building new and improving existing predictive models
  • Porting models to Python or R (e.g. from SAS or Matlab)

Yhat has two parts to it's API - the core API and the real-time Predictions API. We are listing a summary of how they work.

ŷhat Core API

ŷhat claims to empowers data science teams to turn isolated analytical work into predictive APIs which can be immediately consumed by other software systems.

Five Steps to Deploy:

  • Import the ŷhat Library
  • Create a subclass of yhat.Basemodel
  • Define transform and predict functions. These tell ŷhat what to do when the API is called to make predictions. The transform step is just the code we wrote to convert to tf-idf vector representation and our predict step is just the predict Function from the MultinomialNB classifier we're using.
  • Authenticate by passing your Username and APIKEY to yhat.Yhat
  • Train your model and pass it to yh.upload to deploy it.

ŷhat  Real-Time Predictions API

Models deployed to ŷhat can be consumed from any environment using any programming language. You can also make calls to your models using the Python library.

  • Authentication- Authenticate by passing your username and API Key to yhat.Yhat.
  • Listing models deployed to ŷhat -Once authenticated, you can call yhat.Yhat.show_models.
  • Making predictions using the ŷhat Python library- It's easy to make requests to your models yhat.Yhat.predict available in the ŷhat Python library.
  • Making requests from non-Python environments -You can also execute models independently of Python via Web Service calls.

While yhat has clearly a Pythonic focus (especially numPy , Pandas and scikits) , it is very good news for people wanting to use a open source solution for predictive models. Existing providers in hosted models include  RevoDeploy API covered here, Google Prediction API covered here, BigML.com API who we have covered here and the pioneer in PMML based cloud scoring Zementis's ADAPA.

The Documentation  is clearly a work in active progress. There is an example there of training a Naive Bayes classifier to perform text classification, but as the site expands hopefully there will be more examples or a gallery section. The gallery section in BigML.com API is clearly an outstanding example.

Models to predict ? Just another Yhat API call away!

Be sure to read the next API article: Every second counts: Keep track of billable time with Chrometa's API