Skip to content

Applying Machine Learning Techniques to Detect and Understand Fake News

João Lucas Vale Assis

Blue TeamThe Linux Foundation34 minIntermediateOpen on YouTube ↗

Demonstrates applying Machine Learning Techniques to Detect and Understand Fake News and evaluates key implications for security practitioners.

Summary

### Overview At the Open Source Summit North America 2022, Jean Vallet presented an approach to detecting and understanding fake news using natural language processing (NLP) and machine learning. Focusing on Portuguese-language news in Brazil, Vallet explored whether machine learning models trained on older news articles could identify lexical and semantic patterns to accurately classify unseen future news as either real or fake. The presentation detailed the data collection, preprocessing, feature extraction methods, classification algorithms, and visual analysis of word contexts.

### Key Topics - **Misinformation and the Infodemic:** The rapid digital spread of false information across platforms like WhatsApp and Facebook, particularly highlighted during the COVID-19 pandemic, poses challenges for traditional fact-checking workflows. - **Machine Learning Pipeline:** The process relies on three primary components: data collection (web scraping news), feature extraction (words and tokens), and classification algorithms. - **Dataset Design:** Vallet utilized a training corpus of 7,200 news items (3,600 real and 3,600 fake) from the Brazilian fake.br-corpus published between January 2016 and January 2018. The evaluation test dataset comprised 19,440 articles scraped from G1 (real news) and Boatos.org (fake news) published between January 2015 and September 2021. - **Text Representation Techniques:** Tokenization was implemented using TF-IDF (term frequency-inverse document frequency) for statistical weightings across the corpus and Word2Vec for capturing contextual semantic proximity. - **Algorithm Selection and Benchmarking:** The Passive-Aggressive classifier was evaluated against Decision Trees, Random Forest, Support Vector Classifier (SVC), and Logistic Regression.

### Technical Details - **Tooling and Libraries:** Experiments were implemented in Python on open-source Linux within Jupyter Notebook, utilizing pandas, NumPy, scikit-learn, Beautiful Soup, and NLTK. - **Preprocessing:** Pipelines removed punctuation, symbols, and grammatical stop words (such as articles and conjunctions) before tokenization. - **Passive-Aggressive Classifier:** Operates as an online learning algorithm where an input document vector updates the hyperplane's weights when misclassified, using a calculated loss vector while discarding the individual document afterwards. - **Model Performance:** Using TF-IDF features, the Passive-Aggressive classifier trained in roughly 0.2 seconds and achieved an accuracy of 91.73% on the test set. It correctly classified 96% of fake news articles (with a 4% false-positive rate) and 88% of real news articles. The classifier produced a precision of 0.95, a recall of 0.87, and an F1 score of 0.91, outperforming baseline models on balanced F1 evaluation. - **Contextual Visualization:** Using t-SNE alongside Word2Vec embeddings, Vallet demonstrated distinct clustering of word contexts around core political terms (e.g., 'política'), demonstrating that real and fake articles surround identical topics with distinctly different lexical contexts.

### Takeaways - **Temporal Generalization:** The Passive-Aggressive model demonstrated that training on older news corpora can effectively generalize to classify unseen news published years later without requiring continuous real-time retraining. - **Practical Decision Support:** The rapid classification speed makes such algorithms suitable as screening filters for fact-checking organizations, automating high-probability triage so human investigators can focus on ambiguous cases. - **Ethical Considerations:** Future applications in social platforms, bots, or APIs must confront ethical challenges regarding training data curation, label reliability, and potential algorithmic bias.

Related talks