File size: 9,661 Bytes
b6b3da5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
---
license: cc-by-4.0
task_categories:
- image-classification
- text-classification
- image-to-text
- image-feature-extraction
tags:
- fashion
- recommendation
- embeddings
- retail
- e-commerce
- multimodal
pretty_name: H&M Fashion - Enhanced with Embeddings
size_categories:
- 100K<n<1M
---

# H&M Personalized Fashion Recommendations - Enhanced Dataset

## Dataset Description

This dataset is a processed and enhanced version of the [H&M Personalized Fashion Recommendations](https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations) Kaggle competition dataset. The original dataset has been cleaned and augmented with pre-computed embeddings and accessible image URLs to facilitate fashion recommendation research and multimodal retrieval applications.

### Dataset Summary

The H&M dataset contains rich product metadata, customer information, and transaction history from H&M's e-commerce platform. This enhanced version includes:
- **~106,000 fashion products** with detailed metadata
- **~1.37 million customers** with demographic information
- **Historical transaction data** for recommendation modeling
- **Product images** accessible via S3 URLs
- **Pre-computed dense embeddings** (BGE-small-en-1.5)
- **Pre-computed sparse embeddings** (SPLADEv1)

### Languages

- English (product descriptions and metadata)

## Enhancements Over Original Dataset

This processed version includes the following improvements:

1. **Data Cleaning**: Removed all null values for improved data quality
2. **Image Accessibility**: All product images uploaded to S3 with direct URL access via `image_url` field
3. **Dense Embeddings**: Pre-computed [BGE-small-en-1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) embeddings for efficient semantic search
4. **Sparse Embeddings**: Pre-computed [SPLADEv1](https://github.com/naver/splade) embeddings for keyword-based retrieval

## Dataset Structure

### Data Instances

Each article (product) record contains:

```json
{
  "article_id": "108775015",
  "product_code": "108775",
  "prod_name": "Strap top",
  "product_type_no": 253,
  "product_type_name": "Vest top",
  "product_group_name": "Garment Upper body",
  "graphical_appearance_no": 1010016,
  "graphical_appearance_name": "Solid",
  "colour_group_code": 9,
  "colour_group_name": "Black",
  "perceived_colour_value_id": 4,
  "perceived_colour_value_name": "Dark",
  "perceived_colour_master_id": 5,
  "perceived_colour_master_name": "Black",
  "department_no": 1676,
  "department_name": "Jersey Basic",
  "index_code": "A",
  "index_name": "Ladieswear",
  "index_group_no": 1,
  "index_group_name": "Ladieswear",
  "section_no": 16,
  "section_name": "Womens Everyday Basics",
  "garment_group_no": 1002,
  "garment_group_name": "Jersey Basic",
  "detail_desc": "Fitted strap top in soft jersey with narrow shoulder straps.",
  "image_url": "https://your-bucket.s3.amazonaws.com/108775015.jpg",
  "bge_embedding": [0.123, -0.456, ...],  // 384-dimensional vector
  "splade_embedding": {"token_id": weight, ...}  // Sparse vector representation
}
```

### Data Fields

#### Article Metadata
- `article_id` (string): Unique product identifier
- `product_code` (string): Product family code
- `prod_name` (string): Product name
- `product_type_no` (int): Product type numeric code
- `product_type_name` (string): Product type description
- `product_group_name` (string): High-level product category
- `graphical_appearance_no` (int): Pattern code
- `graphical_appearance_name` (string): Pattern description (e.g., "Solid", "Stripe")
- `colour_group_code` (int): Color category code
- `colour_group_name` (string): Color category name
- `perceived_colour_value_id` (int): Color brightness/darkness code
- `perceived_colour_value_name` (string): Color brightness description
- `perceived_colour_master_id` (int): Master color category code
- `perceived_colour_master_name` (string): Master color name
- `department_no` (int): Department code
- `department_name` (string): Department name
- `index_code` (string): Index category code
- `index_name` (string): Index category (e.g., "Ladieswear", "Menswear")
- `index_group_no` (int): Index group numeric code
- `index_group_name` (string): Index group name
- `section_no` (int): Section code
- `section_name` (string): Section description
- `garment_group_no` (int): Garment group code
- `garment_group_name` (string): Garment group name
- `detail_desc` (string): Detailed product description

#### Enhanced Fields
- `image_url` (string): Direct S3 URL to product image
- `bge_embedding` (list[float]): 384-dimensional dense embedding from BGE-small-en-1.5
- `splade_embedding` (dict): Sparse embedding from SPLADEv1 with token weights

### Data Splits

The dataset maintains the original temporal structure:
- Training period: 2018-09-20 to 2020-09-22
- Prediction target: Week of 2020-09-23 to 2020-09-29

## Dataset Creation

### Source Data

The original dataset was created by H&M Group for a Kaggle competition aimed at developing personalized fashion recommendation systems. The data represents real customer transactions and product catalog information.

### Processing Pipeline

1. **Data Loading**: Original CSV files from Kaggle competition
2. **Null Removal**: Filtered out records with missing critical fields
3. **Image Upload**: Product images uploaded to S3 for reliable access
4. **Embedding Generation**:
   - **BGE-small-en-1.5**: Dense embeddings generated from product descriptions and metadata
   - **SPLADEv1**: Sparse embeddings for efficient lexical matching
5. **Quality Validation**: Verified embedding dimensions and data integrity

### Embedding Models

#### BGE-small-en-1.5
- **Model**: [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5)
- **Dimension**: 384
- **Use Case**: Dense semantic retrieval, similarity search
- **Input**: Product descriptions and relevant metadata fields

#### SPLADEv1
- **Model**: SPLADE (Sparse Lexical and Expansion Model)
- **Type**: Learned sparse representation
- **Use Case**: Keyword-based retrieval, interpretable search

## Uses

### Direct Use

This dataset is ideal for:
- **Fashion recommendation systems**: Product-to-product and user-to-product recommendations
- **Multimodal retrieval**: Combining text and image features for search
- **Embedding evaluation**: Benchmarking dense and sparse retrieval methods
- **Fashion trend analysis**: Understanding product categorization and customer preferences
- **Vector database applications**: Testing and demonstrating retrieval systems (e.g., with Qdrant, Pinecone, Weaviate)

### Use Cases

```python
from datasets import load_dataset

# Load the dataset
dataset = load_dataset("your-username/hm-fashion-enhanced")

# Example 1: Semantic search using BGE embeddings
query_embedding = model.encode("casual summer dress")
# Use embeddings for similarity search in your vector database

# Example 2: Hybrid search combining dense and sparse
# Combine BGE dense embeddings with SPLADE sparse for best results

# Example 3: Fashion recommendation
# Use transaction history + embeddings for personalized recommendations
```

## Considerations for Using the Data

### Social Impact

Fashion recommendation systems can influence purchasing decisions and consumer behavior. Consider:
- **Diversity**: Ensure recommendations don't reinforce narrow beauty standards
- **Inclusivity**: Product recommendations should serve diverse customer demographics
- **Sustainability**: Consider environmental impact of fast fashion recommendations

### Limitations

- **Temporal Scope**: Data covers 2018-2020; fashion trends evolve rapidly
- **Geographic Bias**: Primarily represents European H&M markets
- **Demographic Representation**: Customer demographics may not represent global population
- **Cold Start**: Limited data for new products and customers
- **Null Removal**: Some products excluded due to missing data

### Privacy

- Customer data has been anonymized
- No personally identifiable information (PII) included
- Transaction history anonymized with customer IDs

## Additional Information

### Dataset Curators

Original dataset: H&M Group via Kaggle
Enhanced version: [Your name/organization]

### Licensing Information

The dataset is released under the Creative Commons Attribution 4.0 International (CC BY 4.0) license, following the original Kaggle competition terms.

### Citation

If you use this dataset, please cite both the original competition and this enhanced version:

```bibtex
@misc{hm-fashion-kaggle,
  title={H\&M Personalized Fashion Recommendations},
  author={H\&M Group},
  year={2022},
  howpublished={Kaggle Competition},
  url={https://www.kaggle.com/competitions/h-and-m-personalized-fashion-recommendations}
}

@misc{hm-fashion-enhanced,
  title={H\&M Personalized Fashion Recommendations - Enhanced with Embeddings},
  author={[Your Name]},
  year={2024},
  howpublished={HuggingFace Datasets},
  url={[your dataset URL]}
}
```

### Contributions

Contributions and feedback are welcome! Please open an issue or pull request if you find any problems or have suggestions for improvements.

### Acknowledgments

- H&M Group for providing the original dataset
- Kaggle for hosting the competition
- BAAI for the BGE embedding model
- NAVER for the SPLADE sparse embedding model

### Contact

For questions or issues, please contact [your contact information] or open an issue on the dataset repository.

---

## Example Notebooks

Coming soon:
- Fashion retrieval with Qdrant vector database
- Hybrid dense-sparse search implementation
- Building a personalized recommendation engine
- Multi-modal fashion search (text + image)