{"id":24486255,"url":"https://github.com/anjmittu/clpsych2021-shared-task-baseline","last_synced_at":"2025-04-13T19:53:11.653Z","repository":{"id":52199958,"uuid":"332886849","full_name":"anjmittu/clpsych2021-shared-task-baseline","owner":"anjmittu","description":"The baseline code for the CLPsych 2021 Shared Task.","archived":false,"fork":false,"pushed_at":"2021-05-05T15:11:51.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T10:38:32.118Z","etag":null,"topics":["baseline-model","nlp","nlp-machine-learning","suicide","suicide-risk-model","tweets"],"latest_commit_sha":null,"homepage":"https://github.com/seanmacavaney/clpsych2021-shared-task","language":"Python","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/anjmittu.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}},"created_at":"2021-01-25T21:20:35.000Z","updated_at":"2023-07-11T21:31:32.000Z","dependencies_parsed_at":"2022-09-09T18:54:49.313Z","dependency_job_id":null,"html_url":"https://github.com/anjmittu/clpsych2021-shared-task-baseline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjmittu%2Fclpsych2021-shared-task-baseline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjmittu%2Fclpsych2021-shared-task-baseline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjmittu%2Fclpsych2021-shared-task-baseline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anjmittu%2Fclpsych2021-shared-task-baseline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anjmittu","download_url":"https://codeload.github.com/anjmittu/clpsych2021-shared-task-baseline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774116,"owners_count":21159524,"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","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":["baseline-model","nlp","nlp-machine-learning","suicide","suicide-risk-model","tweets"],"created_at":"2025-01-21T14:49:04.186Z","updated_at":"2025-04-13T19:53:11.625Z","avatar_url":"https://github.com/anjmittu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Suicide Risk Model\nThis project contains the code for a suicide risk model based on a person's tweets.\n\nWhen running on NORC Enclave see: [README_ENCLAVE.md](README_ENCLAVE.md)\n\n## Overview\n### Directory Structure\n```\n- risk_model\n    - baseline_model.py         :- Runs the baseline model and creates a results output\n    - evaluation.py             :- Evaluations the results from the model\n    - print_data_statistics.py  :- Prints some stats about the data\n    - tokenize_data.py          :- Preforms the preprocessing on the data.\n```\n\n## How to run\n### Set up\nPython3.6+ is required.  Install the needed libraries:\n```\npip install -r requirements.txt\npython -m nltk.downloader words\n```\n\n\n### Running\nAll of the script are run with python\n\n#### tokenize_data.py\nThis script will preprocess the data.  The following steps are done:\n- URLs are removed from the tweets and tweets are made to be lowercase\n- The tweets are tokenized using twikenizer\n- User mentions and emojis are removed from the tweets\n- Hashtags are split into separate words using three methods.  The first to work is used:\n    - Split by camel case\n    - Split on underscores\n    - Smallest split into real words\n- Stop words are removed\n\nBelow is an example calling this script when the data resides in a folder `practice_data`:\n```\npython risk_model/tokenize_data.py --input practice_data --output practice_data\n```\n\n#### baseline_model.py\nThis script will create the baseline model from the data and will output a results file.  The\nresults file is a tsv file with the following form: \n```\n[USER_ID] \\t [LABEL] \\t [SCORE]\n```\nWhere `USER_ID` is the ID field from the source file, `LABEL` is either `1` for suicide\nor `0` for control, and `SCORE` is a real-valued score output score from your system,\nwhere larger numbers indicate the `SUICIDE` class and lower numbers indicate\n`CONTROL`.\n\nThe baseline model is a bag of words model.  It uses count vectors with unigrams and bigrams and \nLogistic Regression for classification. \n\nBelow is an example calling this script when the data resides in a folder `practice_data`:\n```\npython risk_model/baseline_model.py --input practice_data --output practice_data\n```\n\n#### evaluation.py\nThis script will read the results created by the baseline_model.py and output a score.  The \nscript will output `\u003cF1\u003e, \u003cF2\u003e, \u003cTrue Positive Rate\u003e, \u003cFalse Alarm Rate\u003e, \u003cAUC\u003e`.\n\nBelow is an example calling this script when the data resides in a folder `practice_data`:\n```\npython risk_model/evaluation.py --results practice_data/results.tsv --truth practice_data/test_truths.jsonl\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanjmittu%2Fclpsych2021-shared-task-baseline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanjmittu%2Fclpsych2021-shared-task-baseline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanjmittu%2Fclpsych2021-shared-task-baseline/lists"}