模型:
此模型是在CLPsych 2015上进行微调的版本,评估了从Twitter上获取的数据集,以检测潜在的抑郁症用户。它在评估集上实现以下结果:
将推文语料库输入该模型,生成指示用户是否抑郁的标签。标签1表示抑郁,标签0表示非抑郁。
限制:所有长度超过512的标记序列将自动截断。此外,训练和测试数据可能混有错误标记的用户。
您可以直接使用该模型进行情感分析管道:
>>> from transformers import DistilBertTokenizerFast, AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained('distilbert-base-uncased')
>>> from transformers import DistilBertForSequenceClassification
>>> model = DistilBertForSequenceClassification.from_pretrained(r"distilbert-depression-base")
>>> from transformers import pipeline
>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
>>> tokenizer_kwargs = {'padding':True,'truncation':True,'max_length':512}
>>> result=classifier('pain peko',**tokenizer_kwargs) #For truncation to apply in the pipeline.
>>> #Should note that the string passed as the input can be a corpus of tweets concatenated together into one document.
[{'label': 'LABEL_1', 'score': 0.5048992037773132}]
否则,下载文件并在管道中指定包含config.json、pytorch_model.bin和training_args.bin的文件夹的路径
训练过程中使用了以下超参数:
| Epoch | Training Loss | Validation Loss | Accuracy | F1 | Precision | Recall | AUC |
|---|---|---|---|---|---|---|---|
| 1.0 | 0.68 | 0.66 | 0.59 | 0.63 | 0.56 | 0.73 | 0.59 |
| 2.0 | 0.60 | 0.68 | 0.63 | 0.69 | 0.59 | 0.83 | 0.63 |
| 3.0 | 0.52 | 0.67 | 0.64 | 0.66 | 0.62 | 0.72 | 0.65 |