Regression

Predict a continuous number when given a set of features.

Currently the only online regression model is linear regression. Email support@mlrequest.com to request other online regression models.

A regression model takes features as input and produces a floating-point prediction, known as the output variable or just output. This type of model tries to find a correlation with its features to predict a continuous number. For example, regression would be the best type of model for predicting a person's height given their age, because the model is finding a correlation between the input features (age) and output (height). Some real world examples of regression models are listed below.

Model Description

Example Feature Input

Predicting the amount of money a customer will spend in a month (or in a session)

Customer purchase history and frequency, items looked at, items in cart

Predicting the number of seconds a user will be active for a particular session

Previous active session lengths for user, user behavior for this session, user profile

Predicting the amount of traffic to an app after some event (e.g., featured in blog, store discount)

The event type, estimated event reach, profiles of those participating in event

Model Objective

A regression model's objective is to find a function where, given some input features, the distance between the function's output and the training data's output is minimized - some refer to this as the "line of best fit". You can visualize a regression model in a graph where one axis is the output and the others are input features.

Regression Example - Predicting The Temperature Outside

Regression training

Python Client
Python
Javascript
Java
Go
Ruby
C#
Python Client
from mlrequest import Regression
regression = Regression('your-api-key')
features = {
'skies': 'sunny',
'pressure': 29.87,
'humidity': 0.8,
'month': 'july',
'day-of-month': 23
}
training_data = {'features': features, 'label':74.0}
regression.learn(training_data=training_data, model_name='temperature-today')
Python
import requests
features = {
'skies': 'sunny',
'pressure': 29.87,
'humidity': 0.8,
'month': 'july',
'day-of-month': 23
}
payload = {
'model_name': 'temperature-today',
'features': features,
'label': 74.0
}
r = requests.post('https://api.mlrequest.com/v1/regression/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...

Regression prediction

Python Client
Python
Javascript
Java
Go
Ruby
C#
Python Client
features = {
'skies': 'sunny',
'pressure': 29.87,
'humidity': 0.8,
'month': 'july',
'day-of-month': 23
}
r = regression.predict(features=features, model_name='temperature-today')
r.predict_result
Python
import requests
features = {
'skies': 'sunny',
'pressure': 29.87,
'humidity': 0.3,
'month': 'may',
'day-of-month': 21
}
payload = {
'model_name': 'temperature-today',
'class_count': 2,
'features': features
}
r = requests.post('https://api.mlrequest.com/v1/regression/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...