HomeGetting StartedCreating your first model

Creating your first model

Hopdata: Machine Learning as a Service


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

Tag Lines: Simplifying machine learning. Bringing the power of AI to startups and developers. The Machine Learning for hackers.

Our motive is to create a simple to integrate “Machine Learning” platform but yet powerful enough to provide high accuracy and low latency API.

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 models.

Getting Started

Creating a sentiment analysis engine.

“Sentiment analysis (also known as opinion mining) refers to the use of natural language processing, text analysis and computational linguistics to identify and extract subjective information in source materials.”

Download the sample “sentiment analysis” file Sentiment Analysis

The csv file has only two columns.

  • Label : The label is the one we will be predicting. A value of “0” represents negative or sad sentiment, a value of “4” represents a positive of happy sentiment.
  • Text : The string of text assosiated with the label.

P.S. The first column should always be the label to be predicted.


  • Go to model page , enter the name of the model you want to train and upload the csv.
  • A new “Task” will be created and will be sent to the job scheduler for processing.Based on your account the jobs have different priorities. Once the job is done you will see it on the models page.
  • The system will use the input data and train the machine learning model once the model is trained you can use it predict the sentiment of any text.
  • There will be a form at the bottom of the page which can be used to test the model.

Using the API

  • Go to the Predict->API page and note the API_KEY.
  • You can use one of our sample codes from the API page.
  • To get the predicted class, send a POST request with the appropriate headers to “api.hopdata.com”
  • On successful request processing, a json response is returned.

Make sure you use the same variables names (var0,var1 etc.) as shown on the model details page.

Use one of our sample datasets:

Sample Code


$url = 'http://api.hopdata.com/';

$data = array(
'model_id' => 'replace with model_id ',
'var1' => 'text to predict'

$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencodedrn",
'method' => 'POST',
'content' => http_build_query($data),

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);


import requests
import json
headers = {'content-type': 'application/x-www-form-urlencoded'}
url = 'http://localhost/hopdata.com/web/api.php'
params = {'API_KEY': 'enter your API Key here',
'model_id': 'Enter Model ID here',
'var1': 'Enter text to predict'}
r = requests.post(url, params=params, data=params, headers=headers)

print r.text
Was this article helpful to you? Yes No 1