transformers safetensors roberta text-classification biology medical es dataset:fundacionctic/DermatES arxiv:1910.09700 license:cc-by-nc-nd-4.0 autotrain_compatible endpoints_compatible region:us
---
datasets:
- fundacionctic/DermatES
language:
- es
library_name: transformers
license: cc-by-nc-nd-4.0
metrics:
- accuracy
- f1
pipeline_tag: text-classification
tags:
- biology
- medical
---

# Model Card for Model ID

This is a fine-tuned version of the pre-trained biomedical language model [bsc-bio-ehr-es](https://huggingface.co/PlanTL-GOB-ES/bsc-bio-ehr-es) in Spanish, tailored for text classification tasks. We used two NVIDIA GPUs for training.


## Model Details

### Model Description

This model has been fine-tuned for text classification on dermatological Spanish electronic health records (EHR). It leverages the pre-trained biomedical language understanding from the [bsc-bio-ehr-es](https://huggingface.co/PlanTL-GOB-ES/bsc-bio-ehr-es) model and adapts it to classify dermatology-related texts effectively.
The model is intended to predict among 25 different skin diseases from a medical record. It could be a first visit or a follow-up visit.
It takes as input *textual medical record:* the EHR written by a doctor


This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.

- **Developed by:** [Fundacion CTIC](https://www.fundacionctic.org)
- **Funded by [optional]:** [SATEC](https://www.satec.es)
- **Model type:** Fine-tuned LM Encoder
- **Language(s) (NLP):** Spanish
- **License:** CC-BY-NC 
- **Finetuned from model [optional]:** [bsc-bio-ehr-es](https://huggingface.co/PlanTL-GOB-ES/bsc-bio-ehr-es)

### Model Sources [optional]

<!-- Provide the basic links for the model. -->

- **Repository:** 
- **Paper [optional]:** Coming soon...
- **Demo [optional]:** [More Information Needed]

## Uses

The Model is industry-friendly but not the best model of the **dermat** collection. The top version of the model is called [predict-dermat](https://huggingface.co/fundacionctic/predict-dermat/) and is meant to predict not only the disease but also the 3 features mentionned above. 
We DO NOT recommend to fine-tune this model. It is already meant to be a downstream task.
### Direct Use

This model can be directly used for classifying dermatological text data in Spanish EHRs.


### Downstream Use [optional]
The model can be integrated into healthcare applications for automatic classification of dermatological conditions from patient records.


[More Information Needed]

### Out-of-Scope Use

The model is not suitable for non-medical text classification tasks or for texts in languages other than Spanish.

[More Information Needed]

## Bias, Risks, and Limitations

This model is fine-tuned on a specific dataset and may not generalize well to other types of medical texts or conditions. Users should be cautious of biases in the training data that could affect the model's performance.

[More Information Needed]

### Recommendations

<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->

Users should validate the model's performance on their specific data and consider any ethical implications of deploying a machine learning model in a healthcare setting.

## How to Get Started with the Model
```
from transformers import RobertaTokenizerFast, RobertaForSequenceClassification,

tokenizer = RobertaTokenizerFast.from_pretrained("fundacionctic/vanilla-dermat")
model = RobertaForSequenceClassification.from_pretrained("fundacionctic/vanilla-dermat")


inputs = tokenizer("Ejemplo de texto dermatológico".tolist(),
            truncation=True,
            padding='max_length',
            max_length=max_length,  # Replace with your desired maximum sequence length
            return_tensors='pt',
            return_attention_mask=True,
        ))
outputs = model(input_ids, attention_mask=attention_mask)
```


[More Information Needed]

## Training Details

### Training Data

The model was fine-tuned on the DermatES dataset from Fundación CTIC, which contains Spanish dermatological EHRs.
[More Information Needed]

### Training Procedure

The training used two NVIDIA GPUs (11gb and 49gb)

#### Preprocessing [optional]

Lowercased, anonymized and accents removed texts


#### Training Hyperparameters

- **Training regime:** fp32

#### Speeds, Sizes, Times [optional]

    Epochs: 7
    Batch size: 64
    Learning rate: 0.0001

[More Information Needed]

## Evaluation



### Testing Data, Factors & Metrics


#### Testing Data

The evaluation was performed on 0.2 of the [DermatES](https://huggingface.co/datasets/fundacionctic/DermatES) dataset.

[More Information Needed]

#### Factors

<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->

[More Information Needed]

#### Metrics

    - *Accuracy:* 0.51
    - *F1 Score:* 0.42
    - *top-k (k=2) accuracy:* 0.67
    - *top-k (k=2) f1 Score:* 0.61


#### Summary

The model achieves poor accuracy and F1 score on dermatological text classification, demonstrating the need of using ontologies (see [oracle-dermat](https://huggingface.co/datasets/fundacionctic/oracle-dermat) ) for this specific medical domain.

## Model Examination [optional]

<!-- Relevant interpretability work for the model goes here -->

[More Information Needed]

## Environmental Impact

<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->

Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).

- **Hardware Type:** GPU and CPU with avx
- **Hours used:** >96
- **Cloud Provider:** [More Information Needed]
- **Compute Region:** EU
- **Carbon Emitted:** [More Information Needed]

## Technical Specifications [optional]

### Model Architecture and Objective

The model is based on the [RoBERTa](https://huggingface.co/FacebookAI/roberta-base) architecture, fine-tuned for the objective of text classification in the biomedical domain.

### Compute Infrastructure



#### Hardware

Two NVIDIA GPUs were used for the fine-tuning process.
#### Software

The fine-tuning was performed using the 🤗 Transformers library.

## Citation [optional]

<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->

**BibTeX:** Coming soon 

[More Information Needed]

**APA:**

[More Information Needed]

## Glossary [optional]



## More Information [optional]

[More Information Needed]

## Model Card Authors [optional]

Leon-Paul Schaub Torre, Pelayo Quiros and Helena Garcia-Mieres

## Model Card Contact

leon.schaub@fundacionctic.org