A machine learning-powered fashion recommendation system built with TensorFlow Recommenders and Hopsworks, featuring real-time inference and interactive customer experiences. This project implements a two-tower retrieval model combined with a ranking model to provide personalized fashion recommendations based on H&M customer data.
- Real-time Recommendations: Get personalized fashion item recommendations with real-time inference
- Two-Tower Architecture: Implements customer and item embedding towers for efficient candidate retrieval
- Ranking Model: Uses CatBoost for ranking and reordering recommended items
- Interactive UI: Streamlit-based web interface for customer interaction and feedback
- MLOps Pipeline: Complete feature engineering, training, and deployment pipeline using Hopsworks
- Real-time Feature Store: Track customer interactions and update recommendations dynamically
The system consists of several key components:
- Feature Pipeline: Processes H&M customer, article, and transaction data
- Two-Tower Model: Retrieval model that learns customer and item embeddings
- Ranking Model: CatBoost model for ranking candidate items
- Feature Store: Hopsworks-based feature management and serving
- Streamlit App: Interactive UI for customer recommendations and feedback
- Customer Tower: Encodes customer features (age, membership status, interaction history)
- Item Tower: Encodes article features (garment type, color, department, embeddings)
- Architecture: TensorFlow/Keras with embedding layers and feed-forward networks
- Algorithm: CatBoost gradient boosting
- Features: Customer demographics, item attributes, interaction patterns
- Purpose: Rerank candidate items for personalized recommendations
- Python 3.11+
- uv (Python package manager)
- Hopsworks account and API key
- Git
- Clone the repository:
git clone https://github.com/haturusinghe/realtime-fashion-recommender.git
cd realtime-fashion-recommender- Install Python and dependencies using the Makefile:
# Install Python 3.11 using uv
make install-python
# Create virtual environment and install all dependencies
make install- Set up environment variables:
# Create .env file with your Hopsworks credentials
echo "HOPSWORKS_API_KEY=your_api_key_here" > .envThe project includes a convenient Makefile for easy execution of all pipeline steps:
# 1. Feature engineering
make feature-engineering
# 2. Train retrieval model
make train-retrieval
# 3. Train ranking model
make train-ranking
# 4. Generate item embeddings
make create-embeddings
# 5. Create model deployments
make create-deployments
# 6. Start the Streamlit UI
make start-ui# Run feature engineering pipeline
make feature-engineering
# Train the two-tower retrieval model
make train-retrieval
# Train the CatBoost ranking model
make train-ranking
# Compute item embeddings for similarity search
make create-embeddings
# Deploy models to Hopsworks
make create-deployments
# Start the interactive web application
make start-uirecsys/
├── config.py # Configuration settings
├── features/ # Feature engineering modules
├── hopsworks_integration/ # Hopsworks feature store integration
├── raw_data_sources/ # Data extraction from H&M dataset
├── training/ # Model training modules
└── ui/ # Streamlit UI components
notebooks/ # Jupyter notebooks for pipeline execution
Makefile # Automation commands for easy project execution
streamlit_app.py # Main Streamlit application
pyproject.toml # Python project configuration and dependencies
- Package Manager: uv (fast Python package manager)
- ML Frameworks: TensorFlow, TensorFlow Recommenders, CatBoost
- Feature Store: Hopsworks
- Data Processing: Polars, Pandas
- UI: Streamlit
- Embeddings: Sentence Transformers
- Deployment: Hopsworks Model Serving
- Environment Management: Python 3.11, virtual environments
The system uses the H&M Personalized Fashion Recommendations dataset from Kaggle