Skip to content

oliveira-mtcode/PN_intent_recommendation_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personalized News Recommendation System (Python)

A complete, end-to-end, modular recommendation system for news articles. It simulates or ingests data, preprocesses and engineers features, trains both classical and deep-learning recommenders, evaluates them offline, simulates A/B testing, and serves real-time recommendations via FastAPI.

Highlights

  • Data simulation: news metadata and user interactions (clicks, time, likes)
  • Preprocessing & EDA: cleaning, normalization, notebook walkthrough
  • Feature engineering: TF-IDF (content), user profiles from history
  • Classical recommenders: item-based CF (cosine), truncated-SVD MF
  • Deep recommender: simple two-tower (user/item id embeddings) in PyTorch
  • Offline evaluation: Precision@K, Recall@K, NDCG, MAP
  • A/B testing simulator: online-style evaluation harness
  • Deployment: FastAPI REST service + minimal web UI

Project Structure

.
├─ requirements.txt
├─ README.md
├─ notebooks/
│  └─ 01_eda.ipynb
├─ src/
│  ├─ __init__.py
│  ├─ data/
│  │  └─ simulate.py
│  ├─ preprocess.py
│  ├─ features.py
│  ├─ models/
│  │  ├─ classical.py
│  │  └─ deep.py
│  ├─ eval/
│  │  └─ metrics.py
│  ├─ abtest/
│  │  └─ simulator.py
│  └─ pipeline.py
├─ api/
│  └─ main.py
└─ frontend/
   └─ index.html

Quickstart

  1. Create a virtual environment and install dependencies:
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
  1. Run the training pipeline to generate artifacts:
python -m src.pipeline

This simulates data, preprocesses, builds features, trains recommenders, evaluates them, and saves artifacts to artifacts/.

  1. Start the API server:
uvicorn api.main:app --reload
  1. Open the minimal UI:
  • Navigate to http://127.0.0.1:8000 to see recommendations for a random user.

Workflow (Text Flow)

Ingest/Simulate data → Clean & EDA → Feature engineering → Train (Classical + Deep) → Offline evaluation → A/B Simulation → Package artifacts → Serve via API → Optional frontend

Notebooks

  • notebooks/01_eda.ipynb explains the dataset, behavior patterns, and feature distributions.

Notes

  • Swap in real ingestion instead of simulation as needed.
  • Baselines and deep model are simple and readable; extend as desired.
  • Consider advanced embeddings (e.g., transformer text encoders) for richer content.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published