<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Fake News Detection (NLP)]]></title><description><![CDATA[Discover how I built a Fake News Detection System using NLP and Machine Learning.]]></description><link>https://saiprasathblog01.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 10:52:41 GMT</lastBuildDate><atom:link href="https://saiprasathblog01.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Built a Fake News Detection System Using NLP and Machine Learning]]></title><description><![CDATA[Every day, we scroll through social media and news apps, encountering headlines that look shocking or unbelievable. Later, we often find out they were actually fake.
Fake news spreads fast and can mislead thousands of people within minutes. As a stud...]]></description><link>https://saiprasathblog01.hashnode.dev/how-i-built-a-fake-news-detection-system-using-nlp-and-machine-learning</link><guid isPermaLink="true">https://saiprasathblog01.hashnode.dev/how-i-built-a-fake-news-detection-system-using-nlp-and-machine-learning</guid><category><![CDATA[Machine Learning]]></category><category><![CDATA[Python]]></category><category><![CDATA[ student projects]]></category><category><![CDATA[#AI #MachineLearning #NLP #BeginnerFriendly #Tokenization]]></category><dc:creator><![CDATA[Saiprasath]]></dc:creator><pubDate>Sat, 07 Feb 2026 19:25:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770491704369/e78ff16d-428e-41a0-839c-e910ee9202d5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Every day, we scroll through social media and news apps, encountering headlines that look shocking or unbelievable. Later, we often find out they were actually fake.</p>
<p>Fake news spreads fast and can mislead thousands of people within minutes. As a student interested in software development and machine learning, I started wondering:</p>
<blockquote>
<p><strong>“Can we build a system that automatically detects whether a news article is fake or real?”</strong></p>
</blockquote>
<p>That simple question became the motivation for this project. In this blog, I’ll walk through how I built a <strong>Fake News Detection System</strong> using Natural Language Processing (NLP) and Machine Learning, the challenges I faced, and what I learned along the way.</p>
<h3 id="heading-project-goal">🎯 Project Goal</h3>
<p>The main objective was simple: <strong>Given a news article, predict whether it is Fake or Real.</strong></p>
<p>I wanted to:</p>
<ul>
<li><p>Work with real-world text data.</p>
</li>
<li><p>Apply NLP techniques (Cleaning, Tokenization, Vectorization).</p>
</li>
<li><p>Train and compare machine learning models.</p>
</li>
<li><p>Build something practical rather than just studying theory.</p>
</li>
</ul>
<h3 id="heading-tech-stack">🛠 Tech Stack</h3>
<p>I kept the tech stack simple and beginner-friendly to focus on the core concepts:</p>
<ul>
<li><p><strong>Language:</strong> Python</p>
</li>
<li><p><strong>Libraries:</strong> Pandas, NumPy, Scikit-learn</p>
</li>
<li><p><strong>NLP Tools:</strong> TF-IDF Vectorizer</p>
</li>
<li><p><strong>Models:</strong> Logistic Regression, Naive Bayes</p>
</li>
<li><p><strong>Environment:</strong> Jupyter Notebook</p>
</li>
</ul>
<h3 id="heading-the-dataset">📂 The Dataset</h3>
<p>I used a labeled dataset containing thousands of records with three main columns:</p>
<ol>
<li><p><strong>Title:</strong> The headline of the news.</p>
</li>
<li><p><strong>Content:</strong> The full body text.</p>
</li>
<li><p><strong>Label:</strong> <code>Fake</code> or <code>Real</code>.</p>
</li>
</ol>
<p>At first glance, the dataset looked clean, but I quickly realized that <strong>real-world text data is messy.</strong> It was filled with special characters, random symbols, and unnecessary "noise" words.</p>
<h3 id="heading-step-1-data-cleaning-amp-preprocessing">🧹 Step 1: Data Cleaning &amp; Preprocessing</h3>
<p>Before training, I had to clean the text. This is the most crucial part of any NLP project. I performed:</p>
<ol>
<li><p><strong>Lowercasing:</strong> Standardizing all text.</p>
</li>
<li><p><strong>Removing Punctuation:</strong> Stripping out commas, dots, and symbols.</p>
</li>
<li><p><strong>Stopword Removal:</strong> Filtering out common words like "the", "is", and "and".</p>
</li>
<li><p><strong>Tokenization:</strong> Breaking sentences into individual words.</p>
</li>
</ol>
<p><strong>Key Lesson:</strong> I initially thought model selection was the hardest part, but I learned that <strong>good preprocessing improves accuracy more than fancy models.</strong></p>
<h3 id="heading-step-2-converting-text-to-numbers-tf-idf">🧠 Step 2: Converting Text to Numbers (TF-IDF)</h3>
<p>Machines don’t understand text; they understand numbers. I used <strong>TF-IDF (Term Frequency – Inverse Document Frequency)</strong> to convert my text into vectors.</p>
<p><strong>Why TF-IDF?</strong></p>
<ul>
<li><p>It gives higher weight to unique, important words (e.g., "fraud", "scam").</p>
</li>
<li><p>It reduces the weight of common words that don't help with classification.</p>
</li>
</ul>
<h3 id="heading-step-3-model-training">🤖 Step 3: Model Training</h3>
<p>After vectorization, I experimented with multiple models to find the best fit:</p>
<ul>
<li><p><strong>Logistic Regression</strong></p>
</li>
<li><p><strong>Naive Bayes</strong></p>
</li>
<li><p><strong>Random Forest</strong></p>
</li>
</ul>
<p><strong>The Result:</strong> Logistic Regression performed the best on my dataset! It was fast, simple, and surprisingly accurate.</p>
<h3 id="heading-step-4-evaluation">📊 Step 4: Evaluation</h3>
<p>To ensure the model actually worked, I used standard metrics:</p>
<ul>
<li><p><strong>Accuracy:</strong> ~90%+</p>
</li>
<li><p><strong>Precision &amp; Recall:</strong> Balanced results for both classes.</p>
</li>
</ul>
<p>Seeing the model correctly classify an article it had never seen before was the most satisfying part of the project!</p>
<h3 id="heading-challenges-i-faced">⚠️ Challenges I Faced</h3>
<ol>
<li><p><strong>Noisy Data:</strong> Weird symbols and extra spaces often confused the model until I refined my regex cleaning functions.</p>
</li>
<li><p><strong>Overfitting:</strong> Initially, the model was "memorizing" the training data. I fixed this through better feature tuning and data splitting.</p>
</li>
<li><p><strong>Large Feature Size:</strong> TF-IDF created thousands of features. I had to experiment with parameters like <code>max_features</code> to keep it memory-efficient.</p>
</li>
</ol>
<h3 id="heading-what-i-learned">💡 What I Learned</h3>
<ul>
<li><p><strong>Data cleaning is 80% of the work.</strong></p>
</li>
<li><p>Simple models (like Logistic Regression) are often more than enough for text classification.</p>
</li>
<li><p>Building an end-to-end project builds significantly more confidence than just watching tutorials.</p>
</li>
</ul>
<h3 id="heading-future-improvements">🚀 Future Improvements</h3>
<ul>
<li><p>Try Deep Learning models like <strong>LSTM</strong> or <strong>BERT</strong>.</p>
</li>
<li><p>Build a web interface using <strong>Flask</strong> or <strong>React</strong>.</p>
</li>
<li><p>Deploy the model as a browser extension to flag news in real-time.</p>
</li>
</ul>
<h3 id="heading-project-link">🔗 Project Link</h3>
<p>You can find the full code and documentation here: 👉 <a target="_blank" href="https://github.com/Saiprasath-12/Naan-Mudhalvan-Fake-News-Detector-Project">GitHub: Fake News Detector</a></p>
<hr />
<p><strong>Final Thoughts:</strong> If you’re a student learning ML, I strongly recommend building small, practical projects like this. You’ll learn much faster by solving real errors than by reading documentation.</p>
<p><strong>Thanks for reading!</strong> 🙂</p>
]]></content:encoded></item></channel></rss>