--- library_name: setfit tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer metrics: - accuracy widget: - text: frais douane import vehicule usa carte usd commission - text: debit automatique assurance chien fido protect - text: facture carte du cabinet architecte plan maison est carte - text: achat le monde des oiseaux carte - text: abonnement mensuel salle de sport life fitness club carte pipeline_tag: text-classification inference: true model-index: - name: SetFit results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.18181818181818182 name: Accuracy --- # SetFit This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. The model has been trained using an efficient few-shot learning technique that involves: 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. 2. Training a classification head with features from the fine-tuned Sentence Transformer. ## Model Details ### Model Description - **Model Type:** SetFit - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 128 tokens - **Number of Classes:** 44 classes ### Model Sources - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) ### Model Labels | Label | Examples | |:-------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------| | Shopping / electronics & multimedia | | | Other / kids | | | Bank services / other | | | Housing / rent | | | Transportation / other | | | Bank services / transfers | | | Investment / retirement & savings | | | Other / taxes | | | Healthy & Beauty / other | | | Investment / securities | | | Housing / other | | | Housing / house loan | | | Housing / utilities & bills | | | Bank services / general fees | | | Leisure & Entertainment / culture & events | | | Transportation / taxi & carpool | | | Shopping / other | | | Recurrent Payments / loans | | | Healthy & Beauty / doctor fees | | | Bank services / withdrawal | | | Other / other | | | Healthy & Beauty / pharmacy | | | Transportation / fuel | | | Shopping / sporting goods | | | Food & Drinks / groceries | | | Other / pets | | | Investment / real estate | | | Shopping / clothing | | | Shopping / housing equipment | | | Transportation / maitenance | | | Recurrent Payments / other | | | Recurrent Payments / insurance | | | Healthy & Beauty / veterinary | | | Transportation / public transportation | | | Healthy & Beauty / beauty & self-care | | | Leisure & Entertainment / other | | | Food & Drinks / eating out | | | Housing / services & maintenance | | | Leisure & Entertainment / travel | | | Leisure & Entertainment / sports & hobbies | | | Investment / other | | | Transportation / car loan & leasing | | | Recurrent Payments / subscription | | | Food & Drinks / other | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.1818 | ## Uses ### Direct Use for Inference First install the SetFit library: ```bash pip install setfit ``` Then you can load this model and run inference. ```python from setfit import SetFitModel # Download from the 🤗 Hub model = SetFitModel.from_pretrained("HEN10/setfit-particular-transaction-solon-embeddings-labels-large-kaggle-automatisation-v1") # Run inference preds = model("achat le monde des oiseaux carte") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:-------|:----| | Word count | 3 | 6.2727 | 11 | | Label | Training Sample Count | |:-------------------------------------------|:----------------------| | Housing / rent | 2 | | Housing / house loan | 2 | | Housing / utilities & bills | 2 | | Housing / services & maintenance | 2 | | Housing / other | 2 | | Food & Drinks / groceries | 2 | | Food & Drinks / eating out | 2 | | Food & Drinks / other | 2 | | Leisure & Entertainment / sports & hobbies | 2 | | Leisure & Entertainment / culture & events | 2 | | Leisure & Entertainment / travel | 2 | | Leisure & Entertainment / other | 2 | | Transportation / car loan & leasing | 2 | | Transportation / fuel | 2 | | Transportation / public transportation | 2 | | Transportation / taxi & carpool | 2 | | Transportation / maitenance | 2 | | Transportation / other | 2 | | Recurrent Payments / loans | 2 | | Recurrent Payments / insurance | 2 | | Recurrent Payments / subscription | 2 | | Recurrent Payments / other | 2 | | Investment / securities | 2 | | Investment / retirement & savings | 2 | | Investment / real estate | 2 | | Investment / other | 2 | | Shopping / clothing | 2 | | Shopping / electronics & multimedia | 2 | | Shopping / sporting goods | 2 | | Shopping / housing equipment | 2 | | Shopping / other | 2 | | Healthy & Beauty / doctor fees | 2 | | Healthy & Beauty / pharmacy | 2 | | Healthy & Beauty / beauty & self-care | 2 | | Healthy & Beauty / veterinary | 2 | | Healthy & Beauty / other | 2 | | Bank services / transfers | 2 | | Bank services / withdrawal | 2 | | Bank services / general fees | 2 | | Bank services / other | 2 | | Other / taxes | 2 | | Other / kids | 2 | | Other / pets | 2 | | Other / other | 2 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (1, 1) - max_steps: -1 - sampling_strategy: oversampling - body_learning_rate: (2e-05, 1e-05) - head_learning_rate: 0.01 - loss: CosineSimilarityLoss - distance_metric: cosine_distance - margin: 0.25 - end_to_end: True - use_amp: False - warmup_proportion: 0.1 - seed: 6 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:----:|:-------------:|:---------------:| | 0.0021 | 1 | 0.1221 | - | | 0.1057 | 50 | 0.1337 | - | | 0.2114 | 100 | 0.0617 | - | | 0.3171 | 150 | 0.0397 | - | | 0.4228 | 200 | 0.0377 | - | | 0.5285 | 250 | 0.0133 | - | | 0.6342 | 300 | 0.012 | - | | 0.7400 | 350 | 0.0191 | - | | 0.8457 | 400 | 0.0118 | - | | 0.9514 | 450 | 0.0083 | - | ### Framework Versions - Python: 3.10.13 - SetFit: 1.0.3 - Sentence Transformers: 2.6.1 - Transformers: 4.39.3 - PyTorch: 2.1.2+cpu - Datasets: 2.17.0 - Tokenizers: 0.15.2 ## Citation ### BibTeX ```bibtex @article{https://doi.org/10.48550/arxiv.2209.11055, doi = {10.48550/ARXIV.2209.11055}, url = {https://arxiv.org/abs/2209.11055}, author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren}, keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences}, title = {Efficient Few-Shot Learning Without Prompts}, publisher = {arXiv}, year = {2022}, copyright = {Creative Commons Attribution 4.0 International} } ```