Spending time adding machine learning to your product is almost never worth it for startups.

Formulating the problem, managing training data, training models, serving them, etc... for a 10% increase in some metric just isn't worth the time. Using rules + heuristics, although not optimal, does a pretty good job for a long time.

There should be a better solution between rules & hardcore ML -- an 80/20 way to add ML to any product. Just slap it on top of the rules you already have, get that 10% gain, and never think about it again.

Here's an API that does just that. It's used by a few companies to do everything from shopping cart recommendations to personalized landing page hero text.

Here's how it works:

Javascript example: Personalize hero text based on visitor IP address

const apiKey = '1e9d8ef7948e545d25f189addb17dae1'

// get some recommendations
var data = {
    experimentId: 'personalized-hero-text-bookface',
    context: 'visitor-san-francisco-ip-address',  // visitor city taken from IP
    choices: [
      'The best food, delivered to your door.',
      'The best food in the bay area, delivered to your door.',
    ],
}
var url = '<https://app.banditml.com/api/decision_v2?'> + new URLSearchParams(
  {data: JSON.stringify(data)}
)
var result = await fetch(url, {headers: {'Authorization': `Bearer ${apiKey}`}})
  .then(response => response.json())

> {'model_id': '6c3a48a0-ccad-4e63-8ad2-d2fed613bbf0',
	'choices': ['The best food in the bay area, delivered to your door.', 'The best food, delivered to your door.'],
	'scores': [0.989, 0.610], 
	'message': 'Successfully calculated decision.'}

// provide feedback on how those recommendations did
data = {
    modelId: result.model_id,
    chose: ['The best food in the bay area, delivered to your door.'], // what did you show the visitor? 
    reward: [1.0],  // did they sign up?
}
result = await fetch('<https://app.banditml.com/api/log_decision_v2>', {
  method: 'POST',
  headers: {'Authorization': `Bearer ${apiKey}`},
  body: JSON.stringify(data),
}).then(response => response.json())

Python example: Shopping cart recommendation

import json
import requests

API_KEY = "1e9d8ef7948e545d25f189addb17dae1"

# get some recommendations
data = {
    "experimentId": "add-to-cart-recs-bookface",
    "context": "product-125",  # product user added to cart
    "choices": ["product-24", "product-3", "product-91"],  # options to recommend
}
result = requests.get(
    "<https://app.banditml.com/api/decision_v2>",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={"data": json.dumps(data)},
).json()

> {'model_id': 'b7af145c-846d-4903-ac74-e5ee238d82bc',
	'choices': ['product-91', 'product-24', 'product-3'],
	'scores': [0.7744, 0.154, 0.0807],
	'message': 'Successfully calculated decision.'}

# provide feedback on how those recommendations did
data = {
    "modelId": result["model_id"],
    "chose": ["product-91", "product-24"],  # what did you choose to show the user?
    "reward": [1.0, 0.0],  # did they add what you showed them to cart?
}
result = requests.post(
    "<https://app.banditml.com/api/log_decision_v2>",
    headers={"Authorization": f"Bearer {API_KEY}"},
    data=json.dumps(data),
).json()

The API key above is a real one, so you can use it to try this service out. I'm curious to hear what you think and if it's simple enough to get you to use ML in your product.

If you end up thinking this is cool we'll give you your own API key, just email us at [email protected] or fill out this form.