Commit
·
85f297d
1
Parent(s):
7b0a595
Update space
Browse files
README.md
CHANGED
@@ -10,4 +10,67 @@ pinned: false
|
|
10 |
short_description: Identify Category based on Title and Description
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
short_description: Identify Category based on Title and Description
|
11 |
---
|
12 |
|
13 |
+
# Retail Product Classification Streamlit App
|
14 |
+
|
15 |
+
This Streamlit app is a product classification tool built using a BERT model fine-tuned on a retail product dataset. The model can classify products into one of 21 categories based on their title and description.
|
16 |
+
|
17 |
+
## Dataset
|
18 |
+
|
19 |
+
The model was trained using the [Kaggle Retail Product Classification dataset](https://www.kaggle.com/competitions/retail-products-classification/data). The dataset consists of various product descriptions and their corresponding categories. The training goal was to classify products into 21 distinct categories.
|
20 |
+
|
21 |
+
### Categories and Index Mapping
|
22 |
+
|
23 |
+
| Category | Index |
|
24 |
+
|-----------------------------------|-------|
|
25 |
+
| Electronics | 0 |
|
26 |
+
| Sports & Outdoors | 1 |
|
27 |
+
| Cell Phones & Accessories | 2 |
|
28 |
+
| Automotive | 3 |
|
29 |
+
| Toys & Games | 4 |
|
30 |
+
| Tools & Home Improvement | 5 |
|
31 |
+
| Health & Personal Care | 6 |
|
32 |
+
| Beauty | 7 |
|
33 |
+
| Grocery & Gourmet Food | 8 |
|
34 |
+
| Office Products | 9 |
|
35 |
+
| Arts, Crafts & Sewing | 10 |
|
36 |
+
| Pet Supplies | 11 |
|
37 |
+
| Patio, Lawn & Garden | 12 |
|
38 |
+
| Clothing, Shoes & Jewelry | 13 |
|
39 |
+
| Baby | 14 |
|
40 |
+
| Musical Instruments | 15 |
|
41 |
+
| Industrial & Scientific | 16 |
|
42 |
+
| Baby Products | 17 |
|
43 |
+
| Appliances | 18 |
|
44 |
+
| All Beauty | 19 |
|
45 |
+
| All Electronics | 20 |
|
46 |
+
|
47 |
+
## Model Training
|
48 |
+
|
49 |
+
The model used for this app is a BERT base model (`bert-base-uncased`) fine-tuned using the Hugging Face `transformers` library. The model was trained to classify products into the 21 categories listed above. The fine-tuning was carried out using the following training arguments:
|
50 |
+
|
51 |
+
'''python
|
52 |
+
training_args = TrainingArguments(
|
53 |
+
output_dir='./results',
|
54 |
+
evaluation_strategy='epoch',
|
55 |
+
save_strategy='epoch',
|
56 |
+
logging_strategy="steps",
|
57 |
+
logging_steps=10,
|
58 |
+
per_device_train_batch_size=32,
|
59 |
+
per_device_eval_batch_size=16,
|
60 |
+
num_train_epochs=6,
|
61 |
+
weight_decay=0.01,
|
62 |
+
learning_rate=2e-5,
|
63 |
+
lr_scheduler_type='cosine',
|
64 |
+
warmup_steps=250,
|
65 |
+
logging_dir='./logs',
|
66 |
+
report_to="tensorboard",
|
67 |
+
load_best_model_at_end=True,
|
68 |
+
save_total_limit=3,
|
69 |
+
gradient_accumulation_steps=2,
|
70 |
+
seed=42,
|
71 |
+
eval_accumulation_steps=10,
|
72 |
+
)'''
|
73 |
+
|
74 |
+
## How to run the APP
|
75 |
+
|
76 |
+
Provide any Retail product title and Description in the given text boxes and click on classify product. The app would return the appropriate category
|