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

This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/paraphrase-mpnet-base-v2 as the Sentence Transformer embedding model. A LogisticRegression 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 with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

Model Details

Model Description

Model Sources

Model Labels

Label Examples
negative
  • '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.'
  • '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.'
  • '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.'
positive
  • '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.'
  • '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.'
  • '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.)'

Evaluation

Metrics

Label Accuracy
all 0.8571

Uses

Direct Use for Inference

First install the SetFit library:

pip install setfit

Then you can load this model and run inference.

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 .")

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

@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}
}
Downloads last month
2,603
Safetensors
Model size
109M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ashercn97/code-y-v3

Finetuned
(294)
this model

Evaluation results