CoolFace
Modelpublic

migueladarlo/distilbert-depression-mixed

sourceHugging Facemitupdated 4y agoView on Hugging Face
1likes35downloads
Model Card

distilbert-depression-mixed

This model is a fine-tuned version of distilbert-base-uncased trained on CLPsych 2015 and a scraped dataset, and evaluated on a scraped dataset from Twitter to detect potential users in Twitter for depression. It achieves the following results on the evaluation set:

  • Evaluation Loss: 0.71
  • Accuracy: 0.63
  • F1: 0.59
  • Precision: 0.66
  • Recall: 0.53
  • AUC: 0.63

Intended uses & limitations

Feed a corpus of tweets to the model to generate label if input is indicative of a depressed user or not. Label 1 is depressed, Label 0 is not depressed.

Limitation: All token sequences longer than 512 are automatically truncated. Also, training and test data may be contaminated with mislabeled users.

How to use

You can use this model directly with a pipeline for sentiment analysis:

python
>>> from transformers import DistilBertTokenizerFast, AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained('distilbert-base-uncased')
>>> from transformers import DistilBertForSequenceClassification
>>> model = DistilBertForSequenceClassification.from_pretrained(r"distilbert-depression-mixed")
>>> 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}]

Otherwise, download the files and specify within the pipeline the path to the folder that contains the config.json, pytorchmodel.bin, and trainingargs.bin

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 4.19e-05
  • trainbatchsize: 16
  • evalbatchsize: 16
  • weight_decay: 0.06
  • num_epochs: 5.0

Training results

EpochTraining LossValidation LossAccuracyF1PrecisionRecallAUC
1.00.680.660.610.540.600.500.60
2.00.650.650.630.490.700.370.62
3.00.530.630.660.580.690.500.65
4.00.390.660.670.610.690.540.67
5.00.270.720.650.610.630.600.64