Skip to content

NLP / Machine Learning / Deep Learning

Fake News Detection

A machine learning project applying NLP preprocessing and a feedforward neural network to classify news content as real or fake. The emphasis was on the pipeline — cleaning, vectorising and evaluating properly — rather than on chasing a single accuracy number.

PythonNLPDeep LearningFeedforward NNFlaskscikit-learn
Fake News Detection — schematic overview diagram
Schematic overview — a diagram, not a product screenshot
01Overview

What it is.

The task is a binary text classification problem, but most of the work sits before the model: normalising case and punctuation, removing stopwords, reducing words to their stems, then turning the result into numeric features.

A feedforward neural network is trained on those features and evaluated on a held-out split. The trained model is wrapped in a small Flask app so a piece of text can be pasted in and classified.

02 — The problem

Misleading articles are written to read like legitimate ones, so surface cues such as tone or formatting are unreliable signals on their own.

03 — The approach

Build a reproducible text pipeline, represent articles as numeric feature vectors, and train a neural classifier on labelled examples — then judge it on precision and recall rather than accuracy alone, because the class balance makes accuracy flattering.

04Key features

What it actually does.

Text preprocessing pipeline

Lowercasing, punctuation and stopword removal, tokenisation and stemming applied consistently to train and inference paths.

Feature vectorisation

Cleaned text is converted into numeric vectors that the network can train on.

Feedforward neural network

Dense layers trained on the labelled corpus for binary classification.

Proper evaluation

Held-out test split with precision, recall and confusion matrix — not just an accuracy figure.

Flask inference app

The saved model and vectoriser are loaded once and served behind a simple form.

05Architecture

How the pieces fit together.

Fake News Detection — system architecture diagram
Text preprocessing through to prediction. Diagram, not a screenshot.
  1. 01

    Corpus

    Labelled real/fake news articles split into train and test sets.

  2. 02

    Preprocessing

    A single reusable function so inference applies exactly the same transforms as training.

  3. 03

    Vectoriser

    Fitted on the training split only, then serialised alongside the model.

  4. 04

    Neural network

    Feedforward architecture trained for binary classification.

  5. 05

    Flask app

    Loads the artefacts at startup and returns a prediction per request.

06Technology

The stack.

Chosen for the problem, not for the resume.

Language
Python
ML
Deep LearningFeedforward NNscikit-learn
NLP
TokenisationStopwordsStemmingVectorisation
Serving
Flask
07AI & data workflow

From input to output.

The sequence a single request travels through.

  1. 01

    Clean

    Normalise case, strip punctuation and stopwords.

  2. 02

    Tokenise & stem

    Reduce words to comparable root forms.

  3. 03

    Vectorise

    Fit on training data only to avoid leakage.

  4. 04

    Train

    Feedforward network on the labelled split.

  5. 05

    Evaluate

    Precision, recall and confusion matrix on held-out data.

  6. 06

    Serve

    Load model and vectoriser once in Flask.

08What I learned

The part that stuck.

Student portfolio, so this section is the point — here is what this build actually taught me.

  • 01

    Fitting the vectoriser on the full dataset before splitting leaks test information into training. Catching that changed how I structure every ML notebook since.

  • 02

    Accuracy is a poor headline metric on skewed classes — the confusion matrix told a much more honest story about where the model failed.

  • 03

    The preprocessing function has to be shared between training and inference. Reimplementing it in the Flask app was the first real bug I had to track down.

Next project

Password Manager

A MERN-stack vault for storing and organising website credentials, with per-user isolation.

Work together

Have a project idea?

I'm open to freelance projects, collaborations, internships, and opportunities where I can contribute while continuing to grow.

Usually replies within a day · Lahore, Pakistan · PKT (UTC+5)

Chat on WhatsApp