Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,100 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
Here’s a draft for a model card that you can use for Hugging Face, detailing the purpose, training data, architecture, and intended use of your recommendation model:
|
5 |
+
|
6 |
+
---
|
7 |
+
|
8 |
+
# Model Card: Profile-Based Movie Recommendation Model
|
9 |
+
|
10 |
+
## Model Overview
|
11 |
+
This model is a **profile-based movie recommendation system** designed to recommend movies based on user demographics and genre preferences. It was trained on the [MovieLens 1M dataset](http://files.grouplens.org/datasets/movielens/ml-1m.zip) and uses demographic and genre preferences to create user profiles through clustering. By leveraging user profiles and movie embeddings, the model provides movie recommendations tailored to each user’s interests.
|
12 |
+
|
13 |
+
## Model Architecture
|
14 |
+
The model is built using **TensorFlow** and **Keras** and employs an **embedding-based architecture**:
|
15 |
+
1. **User Profiles and Clustering**: User demographics and genre preferences are clustered into a specified number of profiles using **KMeans** clustering. This results in profile IDs that capture user similarities based on age, occupation, gender, and preferred movie genres.
|
16 |
+
2. **Embedding Layers**:
|
17 |
+
- The **user profile IDs** are embedded in a lower-dimensional space using a trainable embedding layer.
|
18 |
+
- Similarly, **movie IDs** are embedded into a separate lower-dimensional space.
|
19 |
+
3. **Dot Product for Recommendation**: The model computes the dot product between the profile embedding and movie embedding, resulting in a similarity score. The higher the score, the more relevant the movie is predicted to be for the user profile.
|
20 |
+
|
21 |
+
## Training Dataset
|
22 |
+
The model was trained on the [MovieLens 1M dataset](http://files.grouplens.org/datasets/movielens/ml-1m.zip) by GroupLens. The dataset contains **1 million ratings** from **6,040 users** on **3,900 movies**.
|
23 |
+
|
24 |
+
- **Users**: Contains demographic information such as age, gender, and occupation.
|
25 |
+
- **Ratings**: Provides ratings from users for different movies.
|
26 |
+
- **Movies**: Includes movie titles and genres (e.g., Action, Comedy, Romance).
|
27 |
+
|
28 |
+
### Dataset Preparation
|
29 |
+
- **Preprocessing**:
|
30 |
+
- User demographic data was one-hot encoded to include age, occupation, and gender.
|
31 |
+
- User genre preferences were extracted by identifying each user's top-rated genres, with genres being split and exploded for individual assignment.
|
32 |
+
- **Clustering**: User profiles were clustered into 10 groups using KMeans clustering based on demographic and genre features.
|
33 |
+
- **Embedding Preparation**: Profile IDs and Movie IDs were prepared for embedding layers.
|
34 |
+
|
35 |
+
## Training Configuration
|
36 |
+
- **Optimizer**: Adam
|
37 |
+
- **Loss Function**: Mean Squared Error (MSE)
|
38 |
+
- **Metric**: Mean Absolute Error (MAE)
|
39 |
+
- **Epochs**: 10
|
40 |
+
- **Batch Size**: 256
|
41 |
+
- **Embedding Dimension**: 64
|
42 |
+
|
43 |
+
## Intended Use
|
44 |
+
This model is intended to provide **movie recommendations** based on user profile clusters. By embedding user profiles and movies into a shared space, it provides recommendations by finding the best matching movies for a particular user profile.
|
45 |
+
|
46 |
+
### Use Cases
|
47 |
+
- **Personalized Movie Recommendations**: For streaming platforms, this model can serve as the core recommendation engine for suggesting movies tailored to user preferences based on demographics and past high-rated genres.
|
48 |
+
- **User Segmentation**: The model clusters users based on demographic and genre preferences, which can also be used for analysis and targeted advertising.
|
49 |
+
|
50 |
+
### Limitations
|
51 |
+
- **Cold Start Problem**: The model may not perform optimally for new users without enough past ratings or for movies without sufficient interaction data.
|
52 |
+
- **Demographic Constraints**: Recommendations are influenced heavily by demographic data and may not fully capture nuanced user preferences.
|
53 |
+
- **Genre Limitation**: Genre preferences are based on past ratings, which may not always reflect the user’s evolving interests.
|
54 |
+
|
55 |
+
## How to Use
|
56 |
+
To use this model, you'll need:
|
57 |
+
1. **Profile ID**: Identify or calculate the user’s profile ID based on demographics and genre preferences.
|
58 |
+
2. **Movie ID**: Specify the movie IDs you want to score for a particular profile.
|
59 |
+
|
60 |
+
```python
|
61 |
+
from tensorflow import keras
|
62 |
+
import numpy as np
|
63 |
+
|
64 |
+
# Load the trained model
|
65 |
+
model = keras.models.load_model("profile_based_recommendation_model.keras")
|
66 |
+
|
67 |
+
# Example: Generate recommendations for a user with profile_id 3 for movies with IDs 10, 50, and 100
|
68 |
+
profile_id = np.array([3])
|
69 |
+
movie_ids = np.array([10, 50, 100])
|
70 |
+
|
71 |
+
# Predict scores
|
72 |
+
predictions = model.predict([profile_id, movie_ids])
|
73 |
+
|
74 |
+
# Display predicted scores for each movie
|
75 |
+
for movie_id, score in zip(movie_ids, predictions):
|
76 |
+
print(f"Movie ID: {movie_id}, Predicted Score: {score}")
|
77 |
+
```
|
78 |
+
|
79 |
+
## Dataset Citation
|
80 |
+
If you use this model or the dataset, please cite the MovieLens dataset as follows:
|
81 |
+
|
82 |
+
```
|
83 |
+
@article{harper2015movielens,
|
84 |
+
title={The MovieLens datasets: History and context},
|
85 |
+
author={Harper, F Maxwell and Konstan, Joseph A},
|
86 |
+
journal={ACM Transactions on Interactive Intelligent Systems (TIIS)},
|
87 |
+
volume={5},
|
88 |
+
number={4},
|
89 |
+
pages={1--19},
|
90 |
+
year={2015},
|
91 |
+
publisher={ACM New York, NY, USA}
|
92 |
+
}
|
93 |
+
```
|
94 |
+
|
95 |
+
## Acknowledgments
|
96 |
+
Thanks to **GroupLens Research** for providing the MovieLens dataset and the open-source tools that make it accessible for research purposes.
|
97 |
+
|
98 |
+
---
|
99 |
+
|
100 |
+
This model card can be customized further if you want to add more specific instructions or additional use cases.
|