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.
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.
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.
How the pieces fit together.
Corpus
Labelled real/fake news articles split into train and test sets.
Preprocessing
A single reusable function so inference applies exactly the same transforms as training.
Vectoriser
Fitted on the training split only, then serialised alongside the model.
Neural network
Feedforward architecture trained for binary classification.
Flask app
Loads the artefacts at startup and returns a prediction per request.
The stack.
Chosen for the problem, not for the resume.
- Python
- Deep LearningFeedforward NNscikit-learn
- TokenisationStopwordsStemmingVectorisation
- Flask
From input to output.
The sequence a single request travels through.
- 01
Clean
Normalise case, strip punctuation and stopwords.
- 02
Tokenise & stem
Reduce words to comparable root forms.
- 03
Vectorise
Fit on training data only to avoid leakage.
- 04
Train
Feedforward network on the labelled split.
- 05
Evaluate
Precision, recall and confusion matrix on held-out data.
- 06
Serve
Load model and vectoriser once in Flask.
The part that stuck.
Student portfolio, so this section is the point — here is what this build actually taught me.
Fitting the vectoriser on the full dataset before splitting leaks test information into training. Catching that changed how I structure every ML notebook since.
Accuracy is a poor headline metric on skewed classes — the confusion matrix told a much more honest story about where the model failed.
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.
Password Manager
A MERN-stack vault for storing and organising website credentials, with per-user isolation.
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)