Skip to main content

Modeling

Define your adaptive machine learning loop structure and train your initial model. Loops use online learning algorithms that continuously improve with each prediction.

What You Can Build

  • Classification Loops - Predict categories that improve over time (e.g., recommendations, content moderation)
  • Regression Loops - Predict numerical values that refine with more data (e.g., prices, scores, demand)
  • Custom Schemas - Define any input and output structure that fits your use case

How Loops Work

Unlike traditional ML models that require periodic retraining, loops learn incrementally:

  1. Define Your Schema - Specify input fields (features) and output field (prediction target)
  2. Initial Training - Provide training examples to bootstrap your model
  3. Continuous Learning - Each prediction can be fed back as training data
  4. Automatic Updates - The model improves automatically without manual retraining

Defining a Loop

A loop definition requires three components:

1. Task Type

Choose between:

  • Classification - For predicting categories or classes
  • Regression - For predicting numerical values

2. Input Schema

Define the fields your loop will receive for predictions. Each field needs a type:

Supported Types:

  • string - Text data (e.g., "premium", "user_123")
  • integer - Whole numbers (e.g., 25, 100)
  • float - Decimal numbers (e.g., 3.14, 99.99)
  • boolean - True/false values (e.g., true, false)
  • array - Lists of values
  • object - Nested objects

Example Input Schema:

{
"user_id": "string",
"item_id": "string",
"rating": "integer",
"time_of_day": "integer"
}

3. Output Schema

Define the single field your loop will predict. Must contain exactly one field.

Example Output Schema:

{
"recommendation": "string"
}

or for regression:

{
"price": "float"
}

Training Your Loop

Once your loop is defined, you need to provide initial training data to bootstrap the model.

Training Data Format

Each training example must include:

  • All input fields from your input schema
  • The output field from your output schema

Example Training Data:

{
"data": [
{
"user_id": "user_123",
"item_id": "item_456",
"rating": 5,
"time_of_day": 14,
"recommendation": "highly_recommended"
},
{
"user_id": "user_124",
"item_id": "item_789",
"rating": 2,
"time_of_day": 22,
"recommendation": "not_recommended"
}
]
}

Training Requirements

  • Minimum Examples: At least 10-20 examples recommended for initial training
  • Data Quality: Clean, representative data works best
  • Incremental Updates: You can add more training data anytime via the training endpoint

Online Learning

Loops use online learning algorithms, which means:

  • Incremental Updates - Each training example updates the model immediately
  • Memory Efficient - Models don't store all training data, just learned patterns
  • Real-Time Adaptation - Models adapt to new patterns as they emerge
  • No Retraining - Continuous improvement without batch retraining

Best Practices

Schema Design

  • Keep input schemas focused on relevant features
  • Use descriptive field names
  • Choose appropriate data types (e.g., use integer for counts, float for measurements)

Initial Training

  • Provide diverse examples covering different scenarios
  • Include edge cases and boundary conditions
  • Start with 20-50 examples for initial training
  • Add more training data as you use the loop

Continuous Improvement

  • Feed prediction results back as training data when you have ground truth
  • Monitor model performance over time
  • Add new training examples when patterns change
  • Use feature contributions to understand model decisions

Example Use Cases

Recommendation Loop

Input Schema:

{
"user_id": "string",
"item_id": "string",
"user_preferences": "object",
"item_category": "string"
}

Output Schema:

{
"recommendation_score": "float"
}

Content Moderation Loop

Input Schema:

{
"content": "string",
"user_reputation": "integer",
"content_type": "string"
}

Output Schema:

{
"moderation_action": "string"
}

Price Optimization Loop

Input Schema:

{
"product_id": "string",
"demand": "integer",
"competitor_price": "float",
"inventory_level": "integer"
}

Output Schema:

{
"optimal_price": "float"
}