All Projects → 0xTiger → Reddit Stance Classifier

0xTiger / Reddit Stance Classifier

A Flask webapp & Python scripts for predicting reddit users' political leaning, using their comment history.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Reddit Stance Classifier

Stocks
machine learning web app game where the user competes against the AI in picking stocks
Stars: ✭ 108 (+107.69%)
Mutual labels:  flask, sklearn
Python Flask Sklearn Docker Template
A simple example of python api for real time machine learning, using scikit-learn, Flask and Docker
Stars: ✭ 117 (+125%)
Mutual labels:  flask, sklearn
Openuba
A robust, and flexible open source User & Entity Behavior Analytics (UEBA) framework used for Security Analytics. Developed with luv by Data Scientists & Security Analysts from the Cyber Security Industry. [PRE-ALPHA]
Stars: ✭ 127 (+144.23%)
Mutual labels:  flask, sklearn
Sklearn Porter
Transpile trained scikit-learn estimators to C, Java, JavaScript and others.
Stars: ✭ 1,014 (+1850%)
Mutual labels:  sklearn
8d Audio
Some dsp to make songs "8D"
Stars: ✭ 43 (-17.31%)
Mutual labels:  flask
Acmicpc.cc
백준 온라인 저지용 OP.GG
Stars: ✭ 48 (-7.69%)
Mutual labels:  flask
Flask Track Usage
Basic metrics tracking for the Flask framework.
Stars: ✭ 50 (-3.85%)
Mutual labels:  flask
Flask Dashboard Light Bootstrap
Flask Dashboard - Light Bootstrap | AppSeed
Stars: ✭ 42 (-19.23%)
Mutual labels:  flask
Flask Restx
Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
Stars: ✭ 1,050 (+1919.23%)
Mutual labels:  flask
Live Stream Face Detection
Live Streaming and Face Detection with Flask in Browser
Stars: ✭ 47 (-9.62%)
Mutual labels:  flask
Crud Flask Python
CRUD básico com FLASK+PYTHON. Um sisteminha de cadastro de clientes. Muito simples. :)
Stars: ✭ 46 (-11.54%)
Mutual labels:  flask
Betterlifepsi
Betterlife Intelligent PSI(Purchase, Sales and Inventory) system
Stars: ✭ 43 (-17.31%)
Mutual labels:  flask
Docker Flask Mongodb Example
Uses docker compose with a python flask microservice and MongoDB instance to make a sample application
Stars: ✭ 49 (-5.77%)
Mutual labels:  flask
Flask Jwt Router
Flask JWT Router is a Python library that adds authorised routes to a Flask app.
Stars: ✭ 43 (-17.31%)
Mutual labels:  flask
Restfulapi
flask-restful 中小型项目实例
Stars: ✭ 50 (-3.85%)
Mutual labels:  flask
Capsgnn
A PyTorch implementation of "Capsule Graph Neural Network" (ICLR 2019).
Stars: ✭ 1,008 (+1838.46%)
Mutual labels:  sklearn
Hobbit Core
A flask project generator.
Stars: ✭ 49 (-5.77%)
Mutual labels:  flask
Python crawler
It's designed to be a simple, tiny, pratical python crawler using json and sqlite instead of mysql or mongdb. The destination website is Zhihu.com.
Stars: ✭ 45 (-13.46%)
Mutual labels:  flask
Flask pytorch
using flask to run pytorch model
Stars: ✭ 44 (-15.38%)
Mutual labels:  flask
Cookiecutter Flask Minimal
Cookicutter template for minimal production-ready Flask project
Stars: ✭ 48 (-7.69%)
Mutual labels:  flask

reddit-stance-classifier

A Flask webapp & Python scripts for predicting reddit users' political leaning, using their comment history.

usage

View the live webapp

Alternatively: Run one of the classifiers from the command line using the interactive shell option and call pred_lean

\reddit-stance-classifier>python
>>>from prediction import pred_lean
>>>pred_lean('userMcUserFace01010101')
('L', 'L', 0.821243598285102, 0.893544755401233)

The tuple returned is of the form (h_stance, v_stance, h_confidence, v_confidence)

example instance of data

"userMcUserFace01010101": {
  "stance": "libleft",
  "subs": {
    "rollercoasters": 1037,
    "CasualUK": 101,
    "PewdiepieSubmissions": 90,
    "polandball": 68,
    "unpopularopinion": 65,
    "todayilearned": 64,
    "LosAngeles": 62,
    "ShitAmericansSay": 53,
    "im14andthisisdeep": 53,
    "london": 32,
    "reclassified": 26,
    "TheRightCantMeme": 25,
    "CringeAnarchy": 22,
    "HongKong": 22,
    "MovieDetails": 22,
    "GenZ": 21,
  }
}

In this example the "subs" from this instance of data would be encoded into a sparse array and passed into the model as features. The model that has subsequently been trained to predict "stance" would then make a prediction for this new instance of data.

conclusion

As of writing a precision and recall of ~0.8 can be achieved on the unseen test set. It is important to note however, that there may be significant selection bias as all instances of data are from users of r/politicalcompassmemes. Therefore it remains to be seen whether this approach to identifying political positions will generalise to the Reddit population as a whole and make sensible predictions.

Due to the significant class imbalance present in the training data (the number of users that lean 'lib' on the v axis is far greater than those who lean 'auth'). It may be useful to consider alternative metrics such as bACC or PPCR.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].