File size: 16,555 Bytes
807f473
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: '- Barth BM, Shanmugavelandy SS, Tacelosky DM, Kester M, Morad SA, Cabot MC
    (2013). "Gaucher''s disease and cancer: a sphingolipid perspective". Crit Rev
    Oncog 18 (3): 221–34. doi:10.1615/critrevoncog.2013005814. PMC 3604879.'
- text: '"The intersection of attention-deficit/hyperactivity disorder and substance
    abuse". Curr Opin Psychiatry. 24 (4): 280–285. doi:10.1097/YCO.0b013e328345c956.
    PMC .'
- text: 'Parrilla-Rodriguez AM, Gorrin-Peralta JJ. La Lactancia Materna en Puerto
    Rico: Patrones Tradicionales, Tendencias Nacionales y Estrategias para el Futuro.
    P R Health Sci J 1999;18:223-228. (42.) Ni H, Simile C, Hardy AM.'
- text: 'For cases where there is an actual exposure to someone who is confirmed to
    have COVID-19, report code Z20.828, Contact with and (suspected) exposure to other
    viral communicable diseases. This code is not necessary if the exposed patient
    is confirmed to have COVID-19. - Signs and symptoms: For patients presenting with
    any signs/symptoms and where a definitive diagnosis has not been established,
    assign the appropriate code(s) for each of the presenting signs and symptoms such
    as: Cough (R05); Shortness of breath (R06.02) or Fever unspecified (R50.9). Do
    not report “suspected” cases of COVID-19 with B97.29. In addition, diagnosis code
    B34.2, Coronavirus infection, unspecified, typically is not appropriate.'
- text: '- HCPCS codes: what the provider used. - ICD-10-CM: why the provider ''did''
    and ''used''. For example, if a urologist diagnoses a patient with bladder cancer
    and performs a bladder instillation of 1 mg of Bacillus Calmette-Guerin (BCG)
    to treat the tumor, the medical coder might assign:

    - CPT® codes (did): 51720 (Bladder instillation of anticarcinogenic agent (including
    retention time))

    - HCPCS code (used): J9030 (BCG live intravesical instillation, 1mg)

    - ICD-10 code (why): C67.9 (Malignant neoplasm of bladder, unspecified)

    As mentioned above, though, there are some exceptions to these general code set
    concepts. WHEN TO CHOOSE CPT® Vs HCPCS

    First, not all payers accept HCPCS Level II codes. Initially intended for Medicare
    claims, many private payers have since adopted the HCPCS Level II code set.'
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: sentence-transformers/paraphrase-mpnet-base-v2
model-index:
- name: SetFit with sentence-transformers/paraphrase-mpnet-base-v2
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: Unknown
      type: unknown
      split: test
    metrics:
    - type: accuracy
      value: 0.8571428571428571
      name: Accuracy
---

# SetFit with sentence-transformers/paraphrase-mpnet-base-v2

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-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/paraphrase-mpnet-base-v2](https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2)
- **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance
- **Maximum Sequence Length:** 512 tokens
- **Number of Classes:** 2 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| negative | <ul><li>'Estimates of mortality attributable to TB\nVital registration systems were considered to be good in 81 countries with a total population of 2.7 billion (Table 4). Most of the population of the WHO European and South-East Asia Regions and the Region of the Americas was covered by good vital registration systems. However, this proportion was low (< 20%) in the African, Eastern Mediterranean and Western Pacific Regions (Table 4). Of the 22 countries with a high burden of TB, only three (India, Philippines and the Russian Federation) with a total population of 1.3 billion were considered to have good vital registration systems. Seventy-seven of the 81 countries with a good vital registration system reported data on mortality statistics using ICD-9 or ICD-10 to WHO.'</li><li>'2000. Aggressive behavior, increased accumbal dopamine, and decreased cortical serotonin in rats. Journal of Neuroscience, 20(24): 9320-9325. Van Gastel A, Schotte C, Maes M. 1997. The prediction of suicidal intent in depressed patients.'</li><li>'Conventional childhood and adult cardiovascular risk factors did not explain the association between place of birth and AF-related mortality. Lifecourse cardiovascular epidemiology has demonstrated that early life risk factors such as low birthweight and childhood socioeconomic adversity predict greater risk for angina and atherosclerosis as well as adult mortality from coronary heart disease and stroke. (Galobardes et al., 2006, Fabsitz and Feinleib, 1980, Batty et al., 2007, Glymour et al., 2007) Atrial fibrillation (AF) is the most common cardiac arrhythmia, (Benjamin et al., 2009, Magnani et al., 2011) and is responsible for significant morbidity from heart failure, dementia, and stroke, and increased mortality. Few articles have addressed whether early life conditions contribute to the development of AF. Preliminary evidence suggests that early life factors may influence AF, but via mechanisms distinct from those established for most other cardiovascular outcomes.'</li></ul>                                                                            |
| positive | <ul><li>'As a result, these are not reimbursed at the usual rate, sometimes these are not paid at all. The provider has to have in-depth knowledge regarding the assignment of the correct primary and secondary diagnostic codes to ensure full reimbursement. • Reporting all professional services in all settings such as inpatient, outpatient, home and nursing facilities, correctly using the appropriate CPT five digit codes\n• Appropriate use of evaluation and management (E/M) codes or the five digit codes used to report non-procedural professional services. These codes should clearly highlight the complexity of the service provided. Tests such as gait and balance assessment, mini mental status exam, history, physical and family interview do not have their own CPT codes.'</li><li>'Possible locations of an aortic aneurysm are as follows:\n• Ascending (441.2); if ruptured, use 441.1;\n• Arch (441.2); if ruptured, use 441.1;\n• Descending, not otherwise specified (NOS) (441.9); if ruptured, use 441.5;\n• Thoracic descending (441.2); if ruptured, use 441.1;\n• Abdominal descending (441.4); if ruptured, use 441.3;\n• Thoracoabdominal (441.7); if ruptured, use 441.6;\n• Abdominal (441.4); if ruptured, use 441.3. An abdominal aortic aneurysm is the most common type. If an aortic aneurysm is documented but not specified as to site, assign code 441.9. A ruptured aortic aneurysm, NOS is classified to code 441.5. A pseudoaneurysm (false aneurysm) is an aneurysm that does not have some or all of the aortic wall layers.'</li><li>'International Classification of Diseases, Clinical Modification (ICD-9-CM) is an adaption created by the U.S. National Center for Health Statistics (NCHS) and used in assigning diagnostic and procedure codes associated with inpatient, outpatient, and physician office utilization in the United States. The ICD-9-CM is based on the ICD-9 but provides for additional morbidity detail. It is updated annually on October 1. It consists of two or three volumes:\n- Volumes 1 and 2 contain diagnosis codes. (Volume 1 is a tabular listing, and volume 2 is an index.)'</li></ul> |

## Evaluation

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

## 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("ashercn97/code-y-v3")
# Run inference
preds = model("\"The intersection of attention-deficit/hyperactivity disorder and substance abuse\". Curr Opin Psychiatry. 24 (4): 280–285. doi:10.1097/YCO.0b013e328345c956. PMC .")
```

<!--
### 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   | 21  | 101.3125 | 172 |

| Label    | Training Sample Count |
|:---------|:----------------------|
| negative | 8                     |
| positive | 8                     |

### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (4, 4)
- 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: False
- use_amp: False
- warmup_proportion: 0.1
- l2_weight: 0.01
- seed: 42
- eval_max_steps: -1
- load_best_model_at_end: True

### Training Results
| Epoch  | Step | Training Loss | Validation Loss |
|:------:|:----:|:-------------:|:---------------:|
| 0.1111 | 1    | 0.4011        | -               |
| 1.0    | 9    | -             | 0.1458          |
| 2.0    | 18   | -             | 0.0775          |
| 3.0    | 27   | -             | 0.0748          |
| 4.0    | 36   | -             | 0.0664          |

### Framework Versions
- Python: 3.10.12
- SetFit: 1.1.2
- Sentence Transformers: 4.0.2
- Transformers: 4.51.3
- PyTorch: 2.6.0
- Datasets: 3.5.0
- Tokenizers: 0.21.1

## 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.*
-->