Skip to content

preethikamal/Attention-Insight-Engine

Repository files navigation

🧠 Attention Insight Engine

An intelligent nudge generation system that analyzes a user’s profile, history, and real-time attention logs (likes, views, recruiter signals) to produce relevant nudges — such as revealing secret admirers or alerting users to recruiter interest — powered by machine learning and business logic.


📌 Project Overview

Attention Insight Engine is designed to help platforms surface timely nudges that drive user engagement. These nudges are generated based on two core signals:

  1. Reveal Secret Admirer – Triggered if anonymous likes accumulate and cooldown passes
  2. Show Recruiter Signal – Triggered if recruiter views meet threshold

The system uses Random Forest Classifiers trained on realistic, balanced synthetic data. It also includes a rule-based fallback engine for consistency, control, and explainability.


👥 Team Members

  • Chandu Chikkudu
  • Preethi Kamal Gajula
    Interns @ Turtil
    Duration: 6 Weeks

✅ Key Features

  • ✅ ML models trained for two nudges (secret_admirer, recruiter)
  • ✅ Rule-based fallback system for safety and consistency
  • ✅ Cooldown and threshold control via config.json
  • ✅ Data augmentation logic for robust model training
  • ✅ Explainability via source field (model or rule)
  • ✅ FastAPI interface with Swagger UI
  • ✅ Dockerized for deployment and testing

🗂️ Folder Structure

Attention_Insight_Engine/
├── main.py                    # FastAPI entry point
├── insight_engine.py          # Core logic for features & nudges
├── config.json                # Rule thresholds and limits
├── model_secret.pkl           # Trained model for secret admirer
├── model_recruiter.pkl        # Trained model for recruiter signal
├── generate_augmented_data.py # Simulation script for training data
├── train_final_models.py      # Model training code
├── training_data_enhanced.csv # Augmented training dataset
├── requirements.txt           # Python dependencies
├── Dockerfile                 # Docker build config
├── logs.txt                   # Model + rule decision logs
└── README.md                  # Project documentation

⚙️ Configuration (config.json)

{
  "secret_admirer_threshold": 2,
  "reveal_cooldown_days": 3,
  "min_recruiter_views_for_alert": 1,
  "max_daily_nudges": 2
}

These settings determine when nudges are eligible based on anonymous likes, recruiter views, and cooldown logic.


🚀 How to Run (Dockerized Setup)

1. Build the Docker Image

docker build -t attention-engine .

2. Run the Container

docker run -p 8000:8000 attention-engine

3. Open Swagger UI

Navigate to:
http://localhost:8000/docs


🧪 Sample API Request

Endpoint: POST /analyze-attention

Request:

{
  "user_id": "u_demo",
  "profile": {
    "karma": 100,
    "goal_tags": ["SDE"],
    "resume_uploaded": true,
    "has_secret_mode": false
  },
  "attention_logs": {
    "peer_views": [],
    "anonymous_likes": 0,
    "vibe_likes": 0,
    "recruiter_views": [
      {
        "company": "Infosys",
        "role": "Engineer",
        "timestamp": "2025-06-20T10:00:00Z"
      }
    ]
  },
  "history": {
    "last_revealed_secret_admirer": null,
    "last_recruiter_nudge": "2025-05-30"
  }
}

Response:

{
  "user_id": "u_demo",
  "nudges": [
    {
      "type": "recruiter",
      "title": "A recruiter from Infosys viewed your profile",
      "action": "Update your resume to stay visible",
      "priority": "career",
      "source": "model"
    }
  ],
  "status": "generated"
}

📦 Optional: Push to DockerHub

docker tag attention-engine yourdockerhubusername/attention-engine
docker push yourdockerhubusername/attention-engine

🙌 Acknowledgements

  • Thanks to Turtil for the internship opportunity
  • Guided and mentored by the team at Turtil
  • Built using Python, Scikit-learn, FastAPI, and Docker

🔐 Secure. 💡 Explainable. 🚀 Fast.
— The Attention Insight Engine

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages