pytorch deberta-v2 generated_from_trainer base_model:microsoft/mdeberta-v3-base base_model:finetune:microsoft/mdeberta-v3-base license:mit region:us
---
base_model: microsoft/mdeberta-v3-base
license: mit
metrics:
- accuracy
tags:
- generated_from_trainer
model-index:
- name: mdeberta-v3-base-finetuned-environment-energy-climate-classification
  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. -->

# mdeberta-v3-base-finetuned-environment-energy-climate-classification


This model is a fine-tuned version of [microsoft/mdeberta-v3-base](https://huggingface.co/microsoft/mdeberta-v3-base) to classify political texts related to the environment, energy and climate change.

It achieves the following results on the evaluation set:

- Loss: 0.1030
- Accuracy: 0.9748
- F1 Macro: 0.9456
- Accuracy Balanced: 0.9519
- F1 Micro: 0.9748
- Precision Macro: 0.9395
- Recall Macro: 0.9519
- Precision Micro: 0.9748
- Recall Micro: 0.9748

## 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: 16
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.06
- num_epochs: 4

### Training results

| Training Loss | Epoch | Step  | Validation Loss | Accuracy | F1 Macro | Accuracy Balanced | F1 Micro | Precision Macro | Recall Macro | Precision Micro | Recall Micro |
|:-------------:|:-----:|:-----:|:---------------:|:--------:|:--------:|:-----------------:|:--------:|:---------------:|:------------:|:---------------:|:------------:|
| 0.1037        | 1.0   | 9662  | 0.0972          | 0.9723   | 0.9385   | 0.9325            | 0.9723   | 0.9448          | 0.9325       | 0.9723          | 0.9723       |
| 0.0779        | 2.0   | 19324 | 0.0933          | 0.9732   | 0.9427   | 0.9537            | 0.9732   | 0.9324          | 0.9537       | 0.9732          | 0.9732       |
| 0.0474        | 3.0   | 28986 | 0.1030          | 0.9748   | 0.9456   | 0.9519            | 0.9748   | 0.9395          | 0.9519       | 0.9748          | 0.9748       |
| 0.0397        | 4.0   | 38648 | 0.1263          | 0.9750   | 0.9452   | 0.9455            | 0.9750   | 0.9450          | 0.9455       | 0.9750          | 0.9750       |


### Framework versions

- Transformers 4.31.0
- Pytorch 2.5.0+cu121
- Datasets 2.14.7
- Tokenizers 0.13.3

## Usage

```python
from transformers import pipeline

# Load pipeline for text classification
classifier = pipeline("text-classification", model="mljn/mdeberta-v3-base-finetuned-environment-energy-climate-classification")

# Example input text
text = "The government has announced new incentives for renewable energy production, focusing on wind and solar energy to reduce carbon emissions."

# Predict
result = classifier(text)

print("Predicted class:", result[0]['label'])
print("Confidence score:", result[0]['score'])
```

<iframe src="https://huggingface.co/spaces/transformers/default-inference-widget?model=mljn/mdeberta-v3-base-finetuned-environment-energy-classification" width="100%" height="300" ></iframe>

