
# SetFit with sentence-transformers/all-MiniLM-L6-v2

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) as the Sentence Transformer embedding model. 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
- **Sentence Transformer body:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 256 tokens
- **Number of Classes:** 9 classes
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|:------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1     | <ul><li>'As the results indicate, significant differences were found between the experimental group and the control group concerning the characteristics of the exploration process.'</li><li>'No significant differences were found between fallers and non-fallers with respect to height, weight, or age.'</li><li>'There was a significant difference between the 5% calcium hypochlorite group and the other groups (P<0.001).'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 2     | <ul><li>'Our study was also limited by the lack of studies that reported age and gender-specific incidence for morbidity and mortality.'</li><li>'And while quiet stance was examined here, it is important to emphasize that the use of perturbations have provided great insight into those at risk of falling, and future prospective trials which incorporate more sophisticated assessment of fall risk are certain to provide critical information on the reactive mechanics of stability and the effects of age-related degradation on individual balance strategies [25, 26] .Another limitation of this study is the dependence of self-reporting of falls, the key parameter used to stratify the elderly groups into those with recent fall history or those with a limited history of falls.'</li><li>"Because a patient's immigration status is not recorded concomitantly with hospital resource use in any hospital, state, or federal database, it is not currently possible to isolate charity care and bad debt expenditures on An additional complicating factor is the possibility that, as a result of PRWORA, hospitals may provide and bill for services as emergency services that previously were categorized as nonemergency services in order to secure Medicaid payment."</li></ul> |
| 3     | <ul><li>'An 3-(4,5-dimethylthiazol-2yl)-2,5diphenyl tetrazolium bromide assay was used to evaluate the cytotoxicity of polyplexes at a series of N/P ratios in C6 and Hep G2 cells cultured in DMEM (with 10% fetal bovine serum) according to the methods described in our previous studies.'</li><li>'A multivariate analysis using logistic regression was used to evaluate the independent role of each covariate in hospital mortality.'</li><li>'Different methods have been used in the literature for implementing and updating the routing tables using the ant approach such as AntNet [1] .'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 4     | <ul><li>'The results of this study indicate that only the right GVS interfered with mental transformation.'</li><li>'The goal of this work is to explore the effects of general relativity on TDEs occurring in eccentric nuclear disks, and to quantify the distribution of orbital elements of TDEs that originate in eccentric nuclear disks.'</li><li>'Our results may have a number of important implications to the astrophysics of relativistic plasma in general and that of PWN in particular.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| 5     | <ul><li>'The gel retardation results of polymer/pDNA complexes with increasing N/P ratios are shown in Figure 1 .'</li><li>'In line with this, it has been suggested that the drift occurs only when the observed rubber hand is congruent in terms of posture and identity with the participants unseen hand (Tsakiris and Haggard, 2005) .'</li><li>'Mortality rates have been found to be high.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| 6     | <ul><li>'In order to use the information on prior falls in the prediction algorithm, elderly subjects were divided into two groups; those with a record of self-reported recent falls (n = 24; 14.9% of total elderly group) and those who had reported no falls in the prior sixmonth period (n = 137; 85.1% of total elderly group).'</li><li>"Semi-structured interviews were conducted with four 'custodians' (people working in locations where devices were deployed)."</li><li>'Patients who had previously undergone spinal surgery were excluded from the study.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| 7     | <ul><li>'Then, the cells were incubated for 4 h, and fresh media were added to the culture for another 20 h. Then, 10 μl of sterile, filtered 3-(4,5-dimethylthiazol-2yl)-2,5diphenyl tetrazolium bromide solution in phosphate-buffered saline (PBS) (5 mg ml −1 ) was added to each well.'</li><li>'One of the key problems in this area is the identification of influential users, by targeting whom certain desirable outcomes can be achieved.'</li><li>'The paper proceeds as follows.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| 8     | <ul><li>'The main aim of this paper is to present astrophysical parameters such as reddening, distance and age of Be 8 from four colour indices, (B − V ) , (V − I) , (R − I) and (G BP -G RP ) obtained from deep CCD U BV RI and Gaia photometries.'</li><li>'A key finding of the present study was that the rapid increase in GATA4 binding activity in cardiac nuclear extracts in response to pressure overload is mediated by ET-1 but not Ang II.'</li><li>'Section II of this paper provides an overview of the Bosch DCMG system and its components.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| 9     | <ul><li>'These results provide additional support for an activating role for H3K4me3 and a silencing role for H3K27me3 as leaves age.'</li><li>'Based on this result, it may be the case that the rate of apoptosis increases after day 5. in a previous study, mirnas were found to regulate cell proliferation, cell cycle progression and migration by altering the expressions of various factors, such as MalaT1 (48) .'</li><li>'It is therefore likely that the efforts put in by many groups to unravel the spatial regulation of the bAR system will be relevant for the understanding of human disease.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.9433   |

## 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("Corran/Jina_Sci")
# Run inference
preds = model("For this purpose, it was first necessary to discover the interdependencies of the data attributes.")
```

<!--
### Downstream Use

*List how someone could finetune this model on their own dataset.*
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Set Metrics
| Training set | Min | Median  | Max |
|:-------------|:----|:--------|:----|
| Word count   | 5   | 26.2526 | 128 |

| Label | Training Sample Count |
|:------|:----------------------|
| 1     | 300                   |
| 2     | 300                   |
| 3     | 300                   |
| 4     | 300                   |
| 5     | 300                   |
| 6     | 300                   |
| 7     | 300                   |
| 8     | 300                   |
| 9     | 300                   |

### Training Hyperparameters
- batch_size: (75, 75)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 10
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- loss: CosineSimilarityLoss
- distance_metric: cosine_distance
- margin: 0.25
- end_to_end: False
- use_amp: False
- warmup_proportion: 0.1
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: False

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.0014 | 1    | 0.4034        | -               |
| 0.0694 | 50   | 0.2314        | -               |
| 0.1389 | 100  | 0.1816        | -               |
| 0.2083 | 150  | 0.1708        | -               |
| 0.2778 | 200  | 0.1079        | -               |
| 0.3472 | 250  | 0.1407        | -               |
| 0.4167 | 300  | 0.0788        | -               |
| 0.4861 | 350  | 0.0565        | -               |
| 0.5556 | 400  | 0.0651        | -               |
| 0.625  | 450  | 0.0402        | -               |
| 0.6944 | 500  | 0.0468        | -               |
| 0.7639 | 550  | 0.055         | -               |
| 0.8333 | 600  | 0.0473        | -               |
| 0.9028 | 650  | 0.0605        | -               |
| 0.9722 | 700  | 0.03          | -               |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.0.1
- Sentence Transformers: 2.2.2
- Transformers: 4.35.2
- PyTorch: 2.1.0+cu121
- Datasets: 2.16.1
- Tokenizers: 0.15.0

## 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}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->
{"library_name": "setfit", "tags": ["setfit", "sentence-transformers", "text-classification", "generated_from_setfit_trainer"], "metrics": ["accuracy"], "widget": [{"text": "6) , it is interesting to note how, going from lateral to downstream positions, from 1 to 13: -charged hadrons (protons, pions, kaons) contribution rises from 34% to 48%; -electrons and positrons contribution rises from 30% to 40%; -muons doses are stable around the 3-4%, representing an almost negligible portion of the total; -photons doses decrease from 24% to 7% in terms of contribution to the total; -neutrons contribution goes down from 8.5% to 2.5% in terms of contribution to the total."}, {"text": "the study was conducted in 2015 on adolescent undergraduate university students of three fields of study -humanities, as well as medical and technical courses."}, {"text": "For this purpose, it was first necessary to discover the interdependencies of the data attributes."}, {"text": "The patients included in this study were recruited from the Vascular Department of West China Hospital, Sichuan University, between January 2009 and January 2011."}, {"text": "1 Likewise, age at diagnosis (P \u03fd 0.001), primary site (P \u03ed 0.04), number of positive nodes (P \u03fd 0.001), and depth of invasion (P \u03fd 0.001) had a significant impact on diseasespecific survival of the MRI patients."}], "pipeline_tag": "text-classification", "inference": true, "base_model": "sentence-transformers/all-MiniLM-L6-v2", "model-index": [{"name": "SetFit with sentence-transformers/all-MiniLM-L6-v2", "results": [{"task": {"type": "text-classification", "name": "Text Classification"}, "dataset": {"name": "Unknown", "type": "unknown", "split": "test"}, "metrics": [{"type": "accuracy", "value": 0.9433333333333334, "name": "Accuracy"}]}]}]}
setfit safetensors bert sentence-transformers text-classification generated_from_setfit_trainer arxiv:2209.11055 base_model:sentence-transformers/all-MiniLM-L6-v2 model-index region:us