File size: 30,996 Bytes
2566371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
---
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: "The ruling allows for the introduction of the accuser's sexual history as\
    \ a way to challenge credibility. This aspect of the law is often controversial\
    \ and can revive debates about victim-blaming. Many believe that a woman's sexual\
    \ history should not be used to undermine her testimony. However, some legal experts\
    \ argue that this type of evidence is sometimes necessary for a fair trial. \n\
    \nOn the other hand, critics of this ruling may assert that it perpetuates a culture\
    \ of disbelief towards victims of sexual assault. They could argue that such evidence\
    \ could deter future victims from coming forward, fearing their private lives\
    \ may be exposed. Furthermore, the defense might leverage this"
- text: '03/10/2014: Policy reviewed; no changes to policy statement. Removed deleted
    HCPCS codes J0560, J0570, and J0580 from the Code Reference section. Added HCPCS
    code J0561. 02/18/2015: Policy description updated regarding polymerase chain
    reaction and the evaluation of the Chemoattractant CXCL13. Medically necessary
    policy statement regarding PCR-based direct detection of B. burgdorferi in CSF
    samples updated to add "and may replace serologic documentation of infection"
    to the policy statement.'
- text: 'In the case of a 17-year-old male with a stabbing injury, the physician has
    an obligation to prioritize the patient''s immediate medical care and ensure his
    safety. Once stabilized, the issue of confidentiality and reporting must be carefully
    considered.


    In this scenario, the law typically mandates that medical professionals report
    injuries resulting from violent acts, such as stabbing, to law enforcement. This
    requirement is in place to help protect the patient and address potential broader
    safety concerns. Despite the patient''s fear of gang retaliation, the physician
    must comply with legal obligations to report the injury.


    It is crucial for the physician to have an open and empathetic conversation with
    the patient. The physician should explain the legal requirements for reporting
    such injuries, the rationale behind these laws, and the steps involved in the
    process. Additionally, the physician can discuss the resources and support available
    to the patient, such as counseling or protective services, to address his concerns
    about safety and retaliation.


    While this situation is challenging due to the patient''s fear, balancing ethical
    obligations to the patient with legal responsibilities is essential. By reporting
    the injury, the physician fulfills their legal duty while seeking to ensure both
    the patient''s and the community''s safety.'
- text: 'The coverage guidelines outlined in the Medical Policy Manual should not
    be used in lieu of the Member''s specific benefit plan language. POLICY HISTORY7/1992:
    Approved by Medical Policy Advisory Committee (MPAC)

    12/30/1999: Policy Guidelines updated

    9/21/2001:Policy rewritten to be reflective of Blue Cross Blue Shield Association
    policy # 7.01.05, Code Reference section updated, CPT code 92507, 92510 added

    11/2001: Reviewed by MPAC; revisions approved

    4/18/2002: Type of Service and Place of Service deleted

    5/29/2002: Code Reference section updated, CPT code 69949 added, HCPCS L8619,
    V5269, V5273, V5299, V5336, V5362, V5363 added

    3/6/2003: Code Reference section updated, CPT code 92601, 92602, 92603, 92604
    added

    7/15/2004: Reviewed by MPAC, bilateral cochlear implantation considered investigational,
    Description section aligned with BCBSA policy # 7.01.05, definition of investigational
    added Policy Guidelines, Sources updated

    10/5/2004: Code Reference section updated, CPT code 69949 deleted, CPT 92507 description
    revised, CPT 92508 added, ICD-9 procedure code 20.96, 20.97, 20.99, 95.49 added,
    ICD-9 diagnosis code range 389.10-389.18 listed separately, ICD-9 diagnosis 389.7
    added, HCPCS L8619 note added, HCPCS V5269, V5273, V5299, V5336, V5362, V5363
    deleted

    3/22/2005: Code Reference section updated, CPT code 92510 description revised,
    HCPCS L8615, L8616, L8617, L8618 with Note: "See POLICY GUIDELINES for information
    regarding replacement of the external component of the cochlear implant" and effective
    date of 1/1/2005 added. 11/15/2005: HCPCS codes K0731, K0732, L8620 added

    03/10/2006: Coding updated. CPT4 / HCPCS 2006 revisions added to policy

    03/13/2006: Policy reviewed, no changes

    09/13/2006: Coding updated. ICD9 2006 revisions added to policy

    12/27/2006: Code Reference section updated per the 2007 HCPCS revisions

    3/27/2007: Policy reviewed, no changes to policy statement.'
- text: 'POLICY HISTORY1/1994: Approved by Medical Policy Advisory Committee (MPAC)

    5/1/2002: Type of Service and Place of Service deleted

    3/25/2004: Reviewed by MPAC, Policy title “Lyme Disease Treatment” renamed “Intravenous
    Antiobiotic Therapy for Lyme Disease”, Description and Policy sections revised
    to be consistent with BCBSA policy # 5.01.08, intravenous antibiotic therapy changed
    from investigational to medically necessary for certain indications, investigation
    definition added, Sources updated, tables added to Code Reference section

    5/5/2004: Code Reference section completed

    3/13/2006: Policy reviewed, no changes

    9/12/2006: Coding reviewed. ICD9 2006 revisions added to policy

    11/13/2006: Code Reference section updated: CPT codes 87475, 87476, and 87477
    deleted from policy

    4/24/2007: Policy reviewed, policy statement rewritten for clarification

    6/21/2007: Policy reviewed, description updated. Policy statement revised; IV
    antibiotic therapy is not medically necessary for uncomplicated cranial nerve
    palsy associated with Lyme disease and antibiotic-refractory Lyme arthritis

    7/19/2007: Reviewed and approved by MPAC

    7/10/2009: Policy reviewed, no changes

    12/15/2009: Coding Section revised with 2010 CPT4 and HCPCS revisions

    02/23/2011: Added the following to the policy statement: Determination of levels
    of the B lymphocyte chemoattractant CXCL13 for diagnosis or monitoring treatment
    is considered investigational. No changes to other policy statements. Removed
    deleted HCPCS codes J0530, J0540, and J0550 from the Code Reference section.'
metrics:
- accuracy
pipeline_tag: text-classification
library_name: setfit
inference: true
base_model: sentence-transformers/all-minilm-l6-v2
---

# 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:** 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>'The decision to lower interest rates suggests that South Korea is attempting to stimulate economic activity. Lower interest rates usually make borrowing cheaper, encouraging businesses to invest and consumers to spend more. However, if consumers are already burdened with debt, they may be hesitant to take on more loans, negating some benefits of the rate cut. \n\nMeanwhile, there is a possibility that lowering rates too much could lead to inflation, as more money circulates in the economy. Alternatively, if the move is not met with increased spending, the central bank could find itself in a situation where it has to further reduce rates or implement unconventional monetary policies. \n\nIt’s'</li><li>"The urgency in the announcement suggests that this is a unique opportunity for investors. Investors who act quickly may benefit from purchasing shares at a favorable rate. However, one must consider that Google’s market valuation is likely already high, which could deter some potential bidders. The notion that Google may soon close the bidding process adds an element of scarcity, compelling investors to hurry. Yet, rushing into an investment without thorough research could lead to poor financial decisions. It is also possible that some investors might believe lucky charms or superstitions could influence the stock market's unpredictability. The competitive landscape in technology could also imply that other companies may soon surpass Google,"</li><li>'The most appropriate initial imaging test for a 28-year-old woman with a breast lump is an ultrasound. Given her age and the characteristics of the lump, an ultrasound is preferred because it effectively evaluates breast lumps in younger women who typically have denser breast tissue, where mammograms might not be as informative. Additionally, an ultrasound can help distinguish between solid masses, like fibroadenomas, and cystic lesions.'</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| positive | <ul><li>'POLICY HISTORY7/1992: Approved by Medical Policy Advisory Committee (MPAC)\n12/30/1999: Policy Guidelines updated\n9/21/2001:Policy rewritten to be reflective of Blue Cross Blue Shield Association policy # 7.01.05, Code Reference section updated, CPT code 92507, 92510 added\n11/2001: Reviewed by MPAC; revisions approved\n4/18/2002: Type of Service and Place of Service deleted\n5/29/2002: Code Reference section updated, CPT code 69949 added, HCPCS L8619, V5269, V5273, V5299, V5336, V5362, V5363 added\n3/6/2003: Code Reference section updated, CPT code 92601, 92602, 92603, 92604 added\n7/15/2004: Reviewed by MPAC, bilateral cochlear implantation considered investigational, Description section aligned with BCBSA policy # 7.01.05, definition of investigational added Policy Guidelines, Sources updated\n10/5/2004: Code Reference section updated, CPT code 69949 deleted, CPT 92507 description revised, CPT 92508 added, ICD-9 procedure code 20.96, 20.97, 20.99, 95.49 added, ICD-9 diagnosis code range 389.10-389.18 listed separately, ICD-9 diagnosis 389.7 added, HCPCS L8619 note added, HCPCS V5269, V5273, V5299, V5336, V5362, V5363 deleted\n3/22/2005: Code Reference section updated, CPT code 92510 description revised, HCPCS L8615, L8616, L8617, L8618 with Note: "See POLICY GUIDELINES for information regarding replacement of the external component of the cochlear implant" and effective date of 1/1/2005 added. 11/15/2005: HCPCS codes K0731, K0732, L8620 added\n03/10/2006: Coding updated. CPT4 / HCPCS 2006 revisions added to policy\n03/13/2006: Policy reviewed, no changes\n09/13/2006: Coding updated. ICD9 2006 revisions added to policy\n12/27/2006: Code Reference section updated per the 2007 HCPCS revisions\n3/27/2007: Policy reviewed, no changes to policy statement. Bilateral cochlear implantation added to Policy Guidelines section\n06/26/2007: Policy statement updated; bilateral cochlear implantation changed from investigational to may be considered medically necessary\n7/19/2007: Reviewed and approved by MPAC\n9/18/2007: Code reference section updated.'</li><li>'11/28/2012: Policy reviewed; no changes. 03/10/2014: Policy reviewed; no changes to policy statement. Removed deleted HCPCS codes J0560, J0570, and J0580 from the Code Reference section. Added HCPCS code J0561. 02/18/2015: Policy description updated regarding polymerase chain reaction and the evaluation of the Chemoattractant CXCL13.'</li><li>'In order for equipment, devices, drugs or supplies [i.e, technologies], to be considered not investigative, the technology must have final approval from the appropriate governmental bodies, and scientific evidence must permit conclusions concerning the effect of the technology on health outcomes, and the technology must improve the net health outcome, and the technology must be as beneficial as any established alternative and the improvement must be attainable outside the testing/investigational setting. The coverage guidelines outlined in the Medical Policy Manual should not be used in lieu of the Member\'s specific benefit plan language. POLICY HISTORY7/1992: Approved by Medical Policy Advisory Committee (MPAC)\n12/30/1999: Policy Guidelines updated\n9/21/2001:Policy rewritten to be reflective of Blue Cross Blue Shield Association policy # 7.01.05, Code Reference section updated, CPT code 92507, 92510 added\n11/2001: Reviewed by MPAC; revisions approved\n4/18/2002: Type of Service and Place of Service deleted\n5/29/2002: Code Reference section updated, CPT code 69949 added, HCPCS L8619, V5269, V5273, V5299, V5336, V5362, V5363 added\n3/6/2003: Code Reference section updated, CPT code 92601, 92602, 92603, 92604 added\n7/15/2004: Reviewed by MPAC, bilateral cochlear implantation considered investigational, Description section aligned with BCBSA policy # 7.01.05, definition of investigational added Policy Guidelines, Sources updated\n10/5/2004: Code Reference section updated, CPT code 69949 deleted, CPT 92507 description revised, CPT 92508 added, ICD-9 procedure code 20.96, 20.97, 20.99, 95.49 added, ICD-9 diagnosis code range 389.10-389.18 listed separately, ICD-9 diagnosis 389.7 added, HCPCS L8619 note added, HCPCS V5269, V5273, V5299, V5336, V5362, V5363 deleted\n3/22/2005: Code Reference section updated, CPT code 92510 description revised, HCPCS L8615, L8616, L8617, L8618 with Note: "See POLICY GUIDELINES for information regarding replacement of the external component of the cochlear implant" and effective date of 1/1/2005 added. 11/15/2005: HCPCS codes K0731, K0732, L8620 added\n03/10/2006: Coding updated. CPT4 / HCPCS 2006 revisions added to policy\n03/13/2006: Policy reviewed, no changes\n09/13/2006: Coding updated.'</li></ul> |

## 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-v2")
# Run inference
preds = model("03/10/2014: Policy reviewed; no changes to policy statement. Removed deleted HCPCS codes J0560, J0570, and J0580 from the Code Reference section. Added HCPCS code J0561. 02/18/2015: Policy description updated regarding polymerase chain reaction and the evaluation of the Chemoattractant CXCL13. Medically necessary policy statement regarding PCR-based direct detection of B. burgdorferi in CSF samples updated to add \"and may replace serologic documentation of infection\" to the policy statement.")
```

<!--
### 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   | 45  | 143.875 | 298 |

| 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.3269        | -               |
| 1.0    | 9    | -             | 0.2071          |
| 2.0    | 18   | -             | 0.1190          |
| 3.0    | 27   | -             | 0.0741          |
| 4.0    | 36   | -             | 0.0629          |

### Framework Versions
- Python: 3.11.10
- SetFit: 1.1.2
- Sentence Transformers: 4.0.2
- Transformers: 4.51.3
- PyTorch: 2.4.1+cu124
- 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.*
-->