--- language: en license: mit tags: - shopping - deals - classification - e-commerce - recommendation datasets: - custom metrics: - accuracy - precision - recall - f1 widget: - text: I'm looking for headphones example_title: Electronics Search - text: Do you have any kitchen appliance deals? example_title: Kitchen Deals - text: Show me the best laptop deals example_title: Laptop Deals - text: I need a new smart TV example_title: Smart TV Search library_name: transformers --- # Shopping Assistant Model This model is trained to classify shopping deals into categories. It can be used to provide better recommendations to users based on their queries. ## Model description The model is based on DistilBERT and is fine-tuned on a dataset of shopping deals. It is trained to classify deals into the following categories: electronics, clothing, home, kitchen, toys, other ## Intended uses & limitations This model is intended to be used for classifying shopping deals and providing recommendations to users. It is not intended to be used for any other purpose. ## Training data The model is trained on a dataset of shopping deals from DealsFinders.com. The dataset is automatically labeled based on keywords in the deal titles and descriptions. ## Training procedure The model is trained using the Hugging Face Transformers library. It is fine-tuned on the deals dataset using a multi-label classification approach. ## Evaluation results The model is evaluated on a held-out validation set. The evaluation metrics include accuracy, precision, recall, and F1 score. ## Usage ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch # Load the model and tokenizer tokenizer = AutoTokenizer.from_pretrained("selvaonline/shopping-assistant") model = AutoModelForSequenceClassification.from_pretrained("selvaonline/shopping-assistant") # Prepare the input text = "I'm looking for headphones" inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True) # Get the model prediction with torch.no_grad(): outputs = model(**inputs) predictions = torch.sigmoid(outputs.logits) # Load the categories categories = ["electronics", "clothing", "home", "kitchen", "toys", "other"] # Get the top categories top_categories = [] for i, score in enumerate(predictions[0]): if score > 0.5: # Threshold for multi-label classification top_categories.append((categories[i], score.item())) # Sort by score top_categories.sort(key=lambda x: x[1], reverse=True) # Print the results for category, score in top_categories: print(f"{category}: {score:.4f}") ```