{"id":19266811,"url":"https://github.com/amey-thakur/depression_detection_using_tweets","last_synced_at":"2025-08-29T16:23:07.564Z","repository":{"id":128678234,"uuid":"500115017","full_name":"Amey-Thakur/DEPRESSION_DETECTION_USING_TWEETS","owner":"Amey-Thakur","description":"Twitter Depression Detection","archived":false,"fork":false,"pushed_at":"2024-03-13T18:31:06.000Z","size":18939,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-12T11:56:23.936Z","etag":null,"topics":["amey","ameythakur","computer-engineering","data-science","depression-detection","depression-detector","machine-learning","megasatish","nlp","project","python","supervised-machine-learning"],"latest_commit_sha":null,"homepage":"https://github.com/Amey-Thakur/DEPRESSION_DETECTION_USING_TWEETS","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amey-Thakur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-05T14:07:40.000Z","updated_at":"2025-02-02T15:08:24.000Z","dependencies_parsed_at":"2025-06-12T11:53:56.258Z","dependency_job_id":null,"html_url":"https://github.com/Amey-Thakur/DEPRESSION_DETECTION_USING_TWEETS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Amey-Thakur/DEPRESSION_DETECTION_USING_TWEETS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amey-Thakur%2FDEPRESSION_DETECTION_USING_TWEETS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amey-Thakur%2FDEPRESSION_DETECTION_USING_TWEETS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amey-Thakur%2FDEPRESSION_DETECTION_USING_TWEETS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amey-Thakur%2FDEPRESSION_DETECTION_USING_TWEETS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amey-Thakur","download_url":"https://codeload.github.com/Amey-Thakur/DEPRESSION_DETECTION_USING_TWEETS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amey-Thakur%2FDEPRESSION_DETECTION_USING_TWEETS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272718481,"owners_count":24981490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amey","ameythakur","computer-engineering","data-science","depression-detection","depression-detector","machine-learning","megasatish","nlp","project","python","supervised-machine-learning"],"created_at":"2024-11-09T20:07:03.475Z","updated_at":"2025-08-29T16:23:07.545Z","avatar_url":"https://github.com/Amey-Thakur.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://img.shields.io/github/license/miladrezazadeh/twitter_depression_detection?style=flat-square)\n![](https://img.shields.io/github/repo-size/miladrezazadeh/twitter_depression_detection)\n\n# Twitter Depression Detection\n\n\u003cdiv class=\"verticalcenter\"\u003e\n\u003cimg src = \"https://github.com/miladrezazadeh/twitter_depression_detection/blob/main/img/app.png?raw=true\" align=\"middle\"\u003e \n\u003c/div\u003e\n\n## Table of Contents\n\n* [Overview](#Overview)\n* [Background and Motivation](#Background-and-Motivation)\n* [Goals](#Goals)\n* [Datasets](#Datasets)\n* [Data Science Pipeline](#Data-Science-Pipeline)\n* [Usage](#Usage)\n* [License](#License)\n* [References](#References)\n\n\u003c!-- * [License](#license) --\u003e\n\n## Overview\n\nSocial media platforms such as Twitter, Instagram and Facebook play dominant roles in our day to day life. The popularity of these platforms has been significantly increased during the pandemic. Studies show that people are more likely to share their feelings and emotions on Twitter since the beginning of the Covid-19 pandemic. Positive emotions are not commonly associated with higher life satisfaction; however, negative emotions are more likely to express a person true feelings. \n\nDepression is the most common mental disorder which is more than just being sad. Some signs of depression are lack of interest in daily activities, significant weight loss or gain, insomnia or excessive sleeping, lack of energy, inability to concentrate, feelings of worthlessness or excessive guilt and in severe cases recurrent thoughts of death or suicide. Auspiciously, depression is treatable. The treatment is a combination of therapy and antidepressant medication.\n\n\u003cdiv class=\"verticalcenter\"\u003e\n\u003cimg src = \"https://github.com/miladrezazadeh/twitter_depression_detection/blob/main/img/depression.png?raw=true\" align=\"middle\"\u003e \n\u003c/div\u003e\n\n\n## Background and Motivation\n\n* Large volumes of data which can be retrieve from social media platforms such as Twitter can potentially provide valuable insights into human behaviour and emotions. \n\n* Twitter is one of the most common platform for people to share their emotions and opinions which could be used to provide a better understanding of their mental health and wellbeing, people’s everyday decision-making and perceptions about their quality of life.\n\n* Depression is the common mental disorder and which may result in suicides. There are more than 300 million people suffer from depression every year globally.\n\n\n## Goals\n\nThe goal of this project is to implement supervised machine learning techniques in order to detect tweets containing depressive characteristics. \n\n\n## Datasets\n\nWe need two types of datasets one with tweets containing depressive characteristic which is obtained from twitter API and the other one with random tweets.\n\n1. Data mining more than 20K tweets by using [Twitter API and Tweepy library](https://github.com/miladrezazadeh/twitter_depression_detection/blob/main/notebooks/data_gathering_twitter_API.ipynb). The raw data retrieved from Twitter can be find [here](https://github.com/miladrezazadeh/twitter_depression_detection/tree/main/data/raw/scrapped).  \n\n2. Random tweets has been extracted from the [Kaggle datasets](https://www.kaggle.com/ywang311/twitter-sentiment/data). \n\nThe processed dataset used for training machine learning algorithms can be find [here](https://github.com/miladrezazadeh/twitter_depression_detection/tree/main/data/processed).\n\n\n## Data Science Pipeline:\n\n* Data Collection : Balanced dataset collected from Twitter API and Kaggle dataset.\n* Data Preprocess: Data Cleaning/exploring/processing/Anotation/Analysis via NLP libraries.\n* EDA and Feature Selection : CountVectorizer, TFIDF, spaCy word embedding model, spaCy word embedding model.\n* Model Selection : Logistics Regression, support vector machine(SVM), k-nearest neighbors(k-NN), Decision Tree Classifier, Random Forest Classifier, Neural Network, LSTM\n* Model Training : Scikit-Learn\n* Inference : F1-Score, Confusion matrix and ROC-AUC to make an inference\n* Model Deployment : Deployment on AWS or heroku\n* Data Product : Flask-based web application\n\n\n## Usage\n\n* Clone this repository\n\n```bash\ngit clone https://github.com/miladrezazadeh/twitter_depression_detection.git \n```\n\n* Create a virtual environment\n\n```bash\npython3 -m venv env\n```\n\n* Activating a virtual environment\n\n```bash\nsource env/bin/activate\n```\n* Libaries to install\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install requred libraries.\n\n```bash\npip install -r requirements.txt\n```\n\nDownload [en_core_web_lg](https://spacy.io/models/en#en_core_web_lg) from Spacy\n\n```bash\npython -m spacy download en_core_web_lg\n```\n* Clean the dataset\n\n```bash\npython clean.py \u003cfile_name\u003e \n```\n* Train the best model\n```bash\npython train.py \u003cfile_name\u003e \u003cmodel_name\u003e\n```\n* Predict \n```bash\npython predict.py \u003ctweet.txt\u003e SVM\n```\n* Run the Flask Application\n - Start flask web server: `python app.py`\n - The server will start on the address http://127.0.0.1:5000 [if port 5000 is not occupied]\n\n\n## License\n\nThis repo has a MIT License.\n\n\n## References\n\n* https://www.apa.org/topics/depression\n* https://www.kaggle.com/ywang311/twitter-sentiment/data\n* https://github.com/tatsath/fin-ml/tree/master/Chapter%2010%20-%20Natural%20Language%20Processing\n* https://towardsdatascience.com/text-classification-with-nlp-tf-idf-vs-word2vec-vs-bert-41ff868d1794\n* https://github.com/kiranrawat/Detecting-Fake-News-On-Social-Media\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famey-thakur%2Fdepression_detection_using_tweets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famey-thakur%2Fdepression_detection_using_tweets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famey-thakur%2Fdepression_detection_using_tweets/lists"}