transformers tensorboard safetensors bert token-classification generated_from_trainer base_model:google-bert/bert-base-cased base_model:finetune:google-bert/bert-base-cased license:apache-2.0 autotrain_compatible endpoints_compatible region:us
---
base_model: bert-base-cased
license: apache-2.0
metrics:
- precision
- recall
- f1
- accuracy
tags:
- generated_from_trainer
model-index:
- name: ncbi_disease_ner
  results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# ncbi_disease_ner

This model is a fine-tuned version of [bert-base-cased](https://huggingface.co/bert-base-cased) on an ncbi_disease dataset.
It achieves the following results on the evaluation set:
- Loss: 0.0921
- Precision: 0.8082
- Recall: 0.8564
- F1: 0.8316
- Accuracy: 0.9835

## Model description

More information needed

## Intended uses & limitations

More information needed

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 5

### Training results

| Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1     | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:---------:|:------:|:------:|:--------:|
| 0.1149        | 1.0   | 680  | 0.0580          | 0.7475    | 0.8501 | 0.7955 | 0.9810   |
| 0.0436        | 2.0   | 1360 | 0.0687          | 0.7430    | 0.8412 | 0.7890 | 0.9825   |
| 0.0164        | 3.0   | 2040 | 0.0702          | 0.7901    | 0.8513 | 0.8196 | 0.9830   |
| 0.0076        | 4.0   | 2720 | 0.0829          | 0.7884    | 0.8666 | 0.8257 | 0.9826   |
| 0.0047        | 5.0   | 3400 | 0.0921          | 0.8082    | 0.8564 | 0.8316 | 0.9835   |


# Run the model
```python
from transformers import pipeline

model_checkpoint = "manibt1993/ncbi_disease_ner"
token_classifier = pipeline(
    "token-classification", model=model_checkpoint, aggregation_strategy="simple"
)
token_classifier("patient has diabtes, anemia, hypertension with ckd which hurts the patient since 6 years. Patient today experience with right leg pain, fever and cough.")
```

### Model output
```python
[{'entity_group': 'Disease',
  'score': 0.69145554,
  'word': 'diabtes',
  'start': 12,
  'end': 19},
 {'entity_group': 'Disease',
  'score': 0.9955915,
  'word': 'anemia',
  'start': 21,
  'end': 27},
 {'entity_group': 'Disease',
  'score': 0.99971104,
  'word': 'hypertension',
  'start': 29,
  'end': 41},
 {'entity_group': 'Disease',
  'score': 0.9249976,
  'word': 'right leg pain',
  'start': 120,
  'end': 134},
 {'entity_group': 'Disease',
  'score': 0.9983512,
  'word': 'fever',
  'start': 136,
  'end': 141},
 {'entity_group': 'Disease',
  'score': 0.99849665,
  'word': 'cough',
  'start': 146,
  'end': 151}]
```

### Framework versions

- Transformers 4.35.2
- Pytorch 2.1.0+cu121
- Datasets 2.16.1
- Tokenizers 0.15.1
