timing-optimizer / README.md
bravo24's picture
Update README.md
ea0702a verified
metadata
title: FomoFeed Timing Optimizer
emoji: 
colorFrom: purple
colorTo: pink
sdk: docker
pinned: false

FomoFeed Timing Optimizer AI

AI-powered optimal posting time prediction based on engagement patterns.

🎯 Purpose

Analyzes user's historical engagement data to recommend the best time to post content.

📥 Input

  • User ID
  • Engagement history (hours when content received engagement)
  • Engagement weights (view=1, like=3, comment=5, save=7)
  • Content type (post/moment)

📤 Output

{
  "optimal_hour": 19,
  "confidence": 0.87,
  "alternative_hours": [20, 18, 21, 13],
  "reasoning": {
    "method": "weighted_pattern_analysis",
    "total_engagements": 142,
    "data_quality": "good"
  }
}

🚀 Usage

Get Optimal Hour

curl -X POST "https://YOUR-SPACE-URL/predict" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 12,
    "engagement_hours": [19, 20, 13, 19, 21, 18],
    "engagement_weights": [1, 3, 1, 5, 3, 1],
    "content_type": "post"
  }'

Get Next Opportunities (48h)

curl -X POST "https://YOUR-SPACE-URL/next_opportunities?count=5" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 12,
    "engagement_hours": [19, 20, 13],
    "engagement_weights": [3, 5, 1]
  }'

🧠 Algorithm

  1. Analyzes weighted distribution of engagement hours
  2. Applies time-of-day bonuses (lunch, evening peaks)
  3. Smooths distribution using neighboring hours
  4. Calculates confidence based on data volume
  5. Returns optimal hour + alternatives

📊 Performance

  • Latency: <50ms
  • Confidence: 0.3-0.95 (increases with more data)
  • Timezone-aware (Turkey UTC+3)

Built with FastAPI + NumPy