73 lines
2.3 KiB
Markdown
73 lines
2.3 KiB
Markdown
# Projekt
|
||
Wykrywanie czy podany SMS to spam - klasyfikacja.
|
||
|
||
## Zbiór danych
|
||
Wykorzystaliśmy zbiór danych [sms spam](https://huggingface.co/datasets/sms_spam). Dataset posiada tylko zbiór treningowy dlatego w trakcie uczenia modeli podzielilśmy go losowo na 3 podzbiory:
|
||
- zbiór testowy 1 000 przykładów
|
||
- zbiór treningowy 4 116 przykładów
|
||
- zbiór walidacyjny 458 przykładów
|
||
|
||
## Ewaluacja
|
||
Ewaluacja modeli występuje po etapie trenowania na zbiorze testowym. Metryki:
|
||
- accuracy 0-100%
|
||
- Matthews’s correlation coefficient - w skrócie accuracy, tylko bierze pod uwagę zbalansowanie zbioru, wyniki: -1 przeciwne predykcje, 0 losowe, 1 100% dokładności.
|
||
|
||
## Rozwiązania
|
||
Wykorzystaliśmy 4 modele - BERT, GPT2, T5 oraz FLAN-T5
|
||
|
||
### Transformer Encoder - BERT
|
||
Najważniejsze cechy:
|
||
- wytrenowany model: bert-base-uncased
|
||
- typ modelu transformers.BertForSequenceClassification
|
||
- input modelu - treść smsa
|
||
- output modelu - klasa 1 lub 2
|
||
- finetuning na zbiorze treningowym
|
||
- adamW optimizer
|
||
- learning rade 2e-5
|
||
- 32 batch size
|
||
- 4 epoch
|
||
- Accuracy: 99%
|
||
- MCC: 0.973
|
||
|
||
### Transformer Decoder - GPT2
|
||
Najważniejsze cechy:
|
||
- wytrenowany model gpt2
|
||
- typ modelu transformers.GPT2ForSequenceClassification
|
||
- input modelu - treść smsa
|
||
- output modelu - klasa 1 lub 2
|
||
- finetuning na zbiorze treningowym
|
||
- adamW optimizer
|
||
- learning rate 2e-5
|
||
- 8 batch size (because of OOM)
|
||
- 4 epoch
|
||
- Accuracy: 99%
|
||
- MCC: 0.960
|
||
|
||
### Transformer Encoder-Decoder - T5
|
||
Najważniejsze cechy:
|
||
- wytrenowany model t5-base
|
||
- typ modelu transformers.T5ForConditionalGeneration
|
||
- input modelu - 'binary classification: ' + treść smsa
|
||
- output modelu - tekstowo '1' lub '0'
|
||
- finetuning na zbiorze treningowym
|
||
- adamW optimizer
|
||
- learning rate 3e-4
|
||
- 16 batch size
|
||
- 4 epoch
|
||
- Accuracy: 74%
|
||
- MCC: 0.190
|
||
|
||
### Zero-shot Transformer Encoder-Decoder - FLAN-T5
|
||
Najważniejsze cechy:
|
||
- wytrenowany model google/flan-t5-base
|
||
- typ modelu transformers.AutoModelForSeq2SeqLM
|
||
- input modelu - Opis zadania + treść smsa
|
||
- Przykład: "Answer the question in one word - true if provided text is spam or false, if provided text is not spam. \nQ: Is this text spam? \nText: treść smsa \nA:"
|
||
- output modelu - tekstowo klasa 1 'true' lub klasa 2 'false'
|
||
- finetuning na zbiorze treningowym
|
||
- adamW optimizer
|
||
- learning rate 3e-4
|
||
- 8 batch size
|
||
- 4 epoch
|
||
- Accauracy: 43%
|
||
- MCC: -0.033 |