code-y-v3 / README.md
ashercn97's picture
Add SetFit model
807f473 verified
metadata
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 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}
}