Canonical URL: https://chargezen.com/docs/checkoutos/smart-recommendations/ai-engine

# AI Engine

Understanding the machine learning behind Smart Recommendations

Last updated: 2025-01-16

The **Smart Recommendations AI Engine** uses advanced machine learning to analyze your store's data and generate highly relevant product suggestions. This guide explains how the algorithms work and how to optimize them for your store.

## Data Inputs

The AI engine processes multiple data sources to generate recommendations:

#### Data Sources

*   Order history — What customers purchase together
*   Browse behavior — Products viewed, time on page, scroll depth
*   Search queries — What customers are looking for
*   Cart additions/removals — Purchase intent signals
*   Product attributes — Categories, tags, descriptions
*   Inventory levels — Stock availability
*   Pricing data — Price points and margins
*   Customer segments — VIP, new, returning, etc.

## Recommendation Algorithms

### Frequently Bought Together

Identifies products that are commonly purchased in the same order:

Frequently Bought Together

```json
{
  "algorithm": "frequently_bought_together",
  "method": "association_rules",
  "parameters": {
    "min_support": 0.01,
    "min_confidence": 0.3,
    "lookback_days": 90,
    "min_co_occurrences": 5
  },
  "output": {
    "product_pairs": [
      {
        "product_a": "moisturizer",
        "product_b": "cleanser",
        "confidence": 0.65,
        "lift": 2.3
      }
    ]
  }
}
```

### Collaborative Filtering

Recommends products based on similar customers' behavior:

Collaborative Filtering

```json
{
  "algorithm": "collaborative_filtering",
  "method": "matrix_factorization",
  "parameters": {
    "latent_factors": 50,
    "regularization": 0.1,
    "learning_rate": 0.01,
    "iterations": 20
  },
  "similarity_metric": "cosine",
  "min_similarity_threshold": 0.3
}
```

### Content-Based Filtering

Finds similar products based on attributes and descriptions:

Content-Based Filtering

```json
{
  "algorithm": "content_based",
  "features": {
    "title_embedding": { "weight": 0.3, "model": "tfidf" },
    "description_embedding": { "weight": 0.2, "model": "tfidf" },
    "category_match": { "weight": 0.25 },
    "tag_overlap": { "weight": 0.15 },
    "price_range": { "weight": 0.1 }
  },
  "similarity_threshold": 0.4
}
```

### Real-Time Scoring

Combines pre-computed models with real-time signals:

Real-Time Scoring

```json
{
  "realtime_signals": {
    "current_cart": {
      "weight": 0.4,
      "boost_related_products": true
    },
    "session_views": {
      "weight": 0.25,
      "decay_factor": 0.8
    },
    "search_query": {
      "weight": 0.2,
      "match_type": "semantic"
    },
    "time_context": {
      "weight": 0.15,
      "factors": ["day_of_week", "time_of_day", "season"]
    }
  }
}
```

## Model Training

Models are trained and updated automatically:

#### Training Schedule

*   Full model retrain — Weekly on Sundays
*   Incremental updates — Daily at midnight
*   Real-time learning — Immediate feedback incorporation
*   A/B model testing — Automatic model comparison

Training Configuration

```json
{
  "training": {
    "schedule": {
      "full_retrain": "0 3 * * 0",
      "incremental": "0 1 * * *"
    },
    "data_requirements": {
      "min_orders": 100,
      "min_products": 50,
      "min_customers": 200
    },
    "validation": {
      "holdout_percentage": 0.2,
      "metrics": ["precision@k", "recall@k", "ndcg"]
    }
  }
}
```

## Personalization

The engine personalizes recommendations for individual customers:

Personalization Config

```json
{
  "personalization": {
    "enabled": true,
    "user_profile": {
      "build_from": [
        "purchase_history",
        "browse_history",
        "wishlist",
        "reviews_written"
      ],
      "profile_decay": 0.95,
      "max_profile_items": 100
    },
    "cold_start": {
      "strategy": "popularity_based",
      "use_session_data": true,
      "segment_defaults": true
    }
  }
}
```

##### Cold Start Problem

For new visitors with no history, the engine uses popularity-based recommendations and session behavior. After 3-5 interactions, personalization kicks in.

## Performance Optimization

The AI engine is optimized for speed:

#### Performance Features

*   Pre-computed recommendations cached at edge
*   Real-time scoring < 50ms latency
*   Batch pre-computation during low-traffic hours
*   Fallback recommendations for cache misses
*   Adaptive computation based on traffic

## Monitoring & Quality

Monitor recommendation quality:

Quality Metrics

```json
{
  "monitoring": {
    "metrics": {
      "precision_at_5": "Relevant items in top 5 / 5",
      "recall_at_10": "Relevant items found / Total relevant",
      "coverage": "Products recommended / Total products",
      "diversity": "Uniqueness of recommendations",
      "novelty": "Long-tail vs popular items"
    },
    "alerts": {
      "ctr_drop": { "threshold": -20, "window": "7d" },
      "coverage_drop": { "threshold": -10, "window": "1d" }
    }
  }
}
```

## Tuning Parameters

##### Algorithm Tuning

*   **Increase diversity** — Lower similarity threshold, add random exploration
*   **Favor new products** — Add recency boost to scoring
*   **Improve relevance** — Increase model training frequency
*   **Handle sparse data** — Lower min\_support thresholds

## Related Topics

[

### Manual Rules

Override AI with custom rules

Learn more



](https://chargezen.com/docs/checkoutos/smart-recommendations/manual)[

### Placements

Where to show recommendations

Learn more



](https://chargezen.com/docs/checkoutos/smart-recommendations/placements)

Was this page helpful?

Need more help? [Contact support](https://chargezen.com/docs/checkoutos/troubleshooting/support)
