Skip to content

Instantly share code, notes, and snippets.

@imshashank
Last active August 29, 2015 14:19
Show Gist options
  • Save imshashank/42d6ffe230f607eca6b1 to your computer and use it in GitHub Desktop.
Save imshashank/42d6ffe230f607eca6b1 to your computer and use it in GitHub Desktop.
Hopdata API Documentation

Hopdata

HOST: http://api.hopdata.com/

Data Mining, Machine Learning and Artificial Intelligence algorithms as a Service

Our motive is to build a synchronous cloud-based training, scenario model selection and tuning, and the ability to add training data on the fly using RESTful API calls. Such a system provides Data Mining, Machine Learning and Artificial Intelligence algorithms as a service. The system has ability to create training model for datasets uploaded as a training set and performs classification on similar datasets in the future using the saved model.

##Algorithms Implemented:

####KNN :
Performs K-nearest neighbors classification for the data based on the previous training data uploaded and trained. The K value is set to the number of labels in the training dataset.

####K-Means Clustering and Train KNN : If the data is not labelled then we can cluster the dataset using K-means algorithm and then train the KNN classifier using the clustered data. Now the data can be classified based on the clustered training set.

####Naive Bayes (Bernoulli, Gaussian and Multinomial) : Provides three types of Naive Bayes classification. Based on user requirement he can choose the algorithm and train the model. Once trained he can classify the data using the trained model.

To use the API you must login at "hopdata.com" , upload a dataset and create a model

#Instructions

To use the API you must login at "hopdata.com" , upload a dataset and create a model

##Dataset Requirements

The training dataset currently used is comma separated and the first column is the label if we are training a model, if the training set doesn’t have labels, There is an API to cluster the data based on kmeans, label the data and then train the model. Download our sample dataset from here: http://hopdata.com/sample.csv The above dataset trains the model on different languages.

##Creating a Model

The "Create Model" page helps you create the required models trained based on the uploaded data.

Select an algorithms type from the dropdown select the uploaded dataset to use. Once a successful model creation you will receive a message.With details on how to use the model for further testing/classification purposes

##List Models

The page shows the created models and other model attributes than a user can manage.

##Testing a model

To enable easy testing of models we created a "Test Model" page, which lists all your running model. On this page the API is automatically entered in the API box in the form. Enter the model you want to test. Enter the data to be tested on in the "Input Data" box. On submit you'll see the predicted value. Will be upgraded to test multiple data inputs soon.

##Using the service directly as an API

Go to the "User API" page to get the URL and the API key created for you.

You can call the created model by making a REST call using

"http://api.hopdata.com/key/model_id/text_to_classify"

Replace key with your API_key

Model_id: By the model_id from the "List Models" page

text_to_classify: The text to be classified by the trained model

Example: Assume your API_KEY is A1234B, To access the “naive classifer” in the above list of models and classify the phrase “happy world”, the call would be

http://api.hopdata.com/A1234B/53/”happy world”

##Sample php code ####Code in php for a GET request

    <?php 
    $url = "http://api.hopdata.com/api_key/model_id/text_to_classify"; 
    $content = file_get_contents($url);
    var_dump($content);
    ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment