Code Monkey home page Code Monkey logo

depression_detector's Introduction

depression_detector

Introduction

Language plays a central role for psychologists who rely on manual coding of patient language for diagnosis. Using language technology for psycholog-ical diagnosis, particularly for depression detection could lead to low-priced screening test and affordable treatment. For Human Behaviour Understanding Using Machine Learning and Psychological Methods project we explore two neural architectures: Recurrent Neural Net-work (RNN) and Bidirectional Encoder Representations from Transformer (BERT), for de-pression detection on Reddit posts. In this repository we will implement the data preparation and pre-procesing as well as the implementation of the RNN and BERT models for detecting depression

Dataset Overview

Dataset used in this project is from the Early Risk Prediction on the Internet (erisk2017) workshop. This dataset provides user-generated content consisting of Reddit posts organized and processed chronologically. Every user ha sreceived a label as risk or non-risk (of depression). The dataset has two parts: a training dataset and a test dataset, and each part has ten chunks with series of XML files. These XML files store users’ posts and the respective posts’ comments. For obtaining the dataset please contact the organisers in this link .

Important libraries used

  1. Pytoch : for training our modles.
  2. SpaCy : for tokenization.
  3. Skorch: library that allow us using pytorch with Skorch.

Pretrained Model

In this project we have tried to train our model using pretrained word vectors provided by stanford university. As we are focusing on social media we have used twitter pretrained word vectors which can be downloaded from this link .

Project Instructions

Instructions

  1. Clone the repository and navigate to the downloaded folder.

    	git clone https://github.com/noureldinalaa/depression_detector.git
    	cd depression_detector 
    
    
  2. Install packages like pytorch and torch vision and some pip packages in requirements text file :

    	conda install pytorch torchvision -c pytorch
            pip install -r requirements.txt
    
  3. Choose which model you would like to train from Depression_detector.py python file, uncomment one of these models:

  • RNN Model without pretrained word vectors .
  • RNN Model With pretrained word vectors .
  • BERT and then start training with
  python Depression_detector.py
  1. To train RNN using Skorch:

    python RNN_skorch.py
    
    

Results

Accuracy in both RNN's Models was almost the same, with accuracy around 80 % on training dataset , 72% on validation dataset and 65% on unseen test dataset. While in Bert accuracy was more promising, with accuracy of 93 % on training dataset and 72% on validation dataset.Noticing that we have tried different hyperparameters and these were the highest results obtained.

For more detailed explanation of these steps, please find it in this link

Next steps

Imporve our models performance to increase the accuracy on unseen dataset.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.