Classification

Predict a category when given a set of features.

Currently the online classifier is a logistic regression model. Email support@mlrequest.com to request other online classifier models.

A classifier model takes features as input and produces an integer prediction, known as a class. This type of model is good for predicting categories or names. For example, a classifier would be the best choice to predict cats from dogs because the output is nominal. Some practical examples of classifiers are listed below.

Model Description

Example Feature Input

Predict website traffic to be humans or bots

Page request frequency, page element interactions, HTTP header data

Predict the best response for a chatbot in a customer support session

Text features from previous support sessions

Predict website visitor's buyer behavior (window shopper, impulse buyer, etc.)

Frequency of orders, referring URL, items viewed, items added to cart

Model Objective

The objective of a classifier is to find boundaries that separate all classes from each other. You can visualize classification as a graph, where every axis of the graph is a feature.

Classifier Example - Predicting If It will Rain Today

Classifier training

Python Client
Python
Javascript
Java
Go
Ruby
C#
Python Client
from mlrequest import Classifier
classifier = Classifier('your-api-key')
features = {
'skies': 'cloudy',
'temperature': 45,
'pressure': 29.87
}
training_data = {'features': features, 'label': 2}
r = classifier.learn(training_data=training_data, model_name='rain-or-shine', class_count=2)
Python
import requests
features = {
'skies': 'sunny',
'temperature': 82,
'pressure': 29.87
}
payload = {
'model_name': 'rain-or-shine',
'class_count': 2,
'features': features,
'label': 2
}
r = requests.post('https://api.mlrequest.com/v1/classifier/learn', json=payload, headers={'MLREQ-API-KEY':'your-api-key'})
Javascript
Coming soon...
Java
Coming soon...
Go
Coming soon...
Ruby
Coming soon...
C#
Coming soon...

Classifier prediction

Python Client
Python
Javascript
Java
Go
Ruby
C#
Python Client
features = {
'skies': 'clear',
'temperature': 77,
'pressure': 28.83
}
r = classifier.predict(features=features, model_name='rain-or-shine', class_count=2)
r.predict_result
Python
import requests
features = {
'skies': 'clear',
'temperature': 37,
'pressure': 28.83
}
payload = {
'model_name': 'rain-or-shine',
'class_count': 2,
'features': features
}
r = requests.post('https://api.mlrequest.com/v1/classifier/predict', json=payload, headers={'MLREQ-API-KEY':'your-api-key'})
Javascript
Coming soon...
Java
Coming soon...
Go
Coming soon...
Ruby
Coming soon...
C#
Coming soon...