A clean, well-organized implementation of Deep Neural Networks for YouTube Recommendations, featuring both Python (TensorFlow) and Scala (Spark) implementations.
DNN-YouTube-RecSys/
├── src/
│ ├── python/ # Python implementation using TensorFlow
│ │ ├── models/ # Core DNN model and loading utilities
│ │ ├── data/ # Data processing and TFRecords handling
│ │ ├── utils/ # TensorBoard and utility functions
│ │ ├── examples/ # Usage examples and tutorials
│ │ └── reference/ # Custom layers and feature engineering
│ └── scala/ # Scala implementation using Spark
│ ├── models/ # Feature building and embedding models
│ ├── data/ # Data generation scripts
│ ├── prediction/ # User vector and item embedding prediction
│ ├── core/ # Base Spark application classes
│ ├── examples/ # Spark usage examples
│ └── config/ # Environment configuration files
├── data/ # Data storage and model artifacts
│ ├── tfrecords/ # Training and evaluation data
│ └── checkpoints/ # Model checkpoints and saved models
├── tests/ # Test suites for both Python and Scala
├── docs/ # Research paper and documentation
├── requirements.txt # Python dependencies
├── pom.xml # Maven configuration for Scala
└── .gitignore # Git ignore patterns
-
Install dependencies:
pip install -r requirements.txt
-
Train the model:
cd src/python python models/dnn.py -
Run examples:
python examples/example1.py python examples/example2.py
-
Build the project:
mvn clean compile
-
Run examples:
mvn exec:java -Dexec.mainClass="example.Example1"
models/dnn.py: Core deep neural network modelmodels/load_dnn_model.py: Model loading and inference utilitiesdata/data2tfrecords.py: Data conversion to TFRecords formatutils/tensor_board.py: TensorBoard integration for training visualization
models/FeatureBuilder.scala: Feature engineering utilitiesprediction/PredictUserVector.scala: User vector predictionprediction/ItemEmbeddingPredictor.scala: Item embedding generationcore/BaseSparkLocal.scala: Local Spark application base class
- Python: Configure via
requirements.txtand environment variables - Scala: Configure via
src/scala/config/properties files - Data: Store training data in
data/tfrecords/directory - Models: Save checkpoints in
data/checkpoints/directory
- Research Paper:
docs/Deep Neural Networks for YouTube Recommendations.pdf - Code Examples: See
src/python/examples/andsrc/scala/examples/ - Reference Implementations: Check
src/python/reference/for custom components
- Follow the established directory structure
- Add tests in the appropriate
tests/subdirectory - Update documentation for any new features
- Ensure both Python and Scala implementations remain consistent
This project implements the research described in "Deep Neural Networks for YouTube Recommendations" paper. Please refer to the original paper for academic citations and research context.