Project Report
Project Report
A PROJECT REPORT
Submitted to
by
Aditya Rana(23010203004)
Piyush Dhiman(23010203030)
BACHELOR OF TECHNOLOGY
in
MAY 2026
CERTIFICATE
We hereby certify that the work which is being performed in the [Link] Project Work Report entitled “FAKE
NEWS DETECTION SYSTEM USING MACHINE LEARNING”, in partial fulfilment of the requirements
for the award of the Bachelor of Technology in Computer Science & Engineering and submitted to the
Department of Computer Science & Engineering of Atal Bihari Vajpayee Govt Institute of Engineering &
Technology, Pragatinagar, Shimla Himachal Pradesh is an authentic record of our own work.
Aditya Rana(23010203004)
Piyush Dhiman(23010203030)
This is to certify that above statement made by the candidates is correct to the best of my knowledge.
Head of
Computer science & Engineering Department
Atal Bihari Vajpayee Govt. Institute of Engineering & Technology, Pragati Nagar.
DECLARATION
We, Aditya Rana and Piyush Dhiman, students of Bachelor of Technology ([Link]) Computer Science &
Engineering Department, Atal Bihari Vajpayee Govt Institute of Engineering & Technology, PragatiNagar
Shimla, having roll no. 23010203004 and 23010203030 hereby declare that the project report entitled “Fake
News Detection System Using Machine Learning” is an original work carried out by us and has not been
submitted elsewhere for any degree or diploma.
Piyush Dhiman(23010203030)
We would like to express my sincere gratitude to our project guide, faculty members, and the Department of
Computer Science Engineering for their valuable support and guidance during the development of this project.
Their guidance helped us to be able to deliver all the required tasks and be able to make valuable contributions
to the project.
It would not have been possible to complete this Project Work- I in short period of time without his kind
encouragement and valuable guidance.
Fake news spreading through digital platforms has become a major issue in modern society. Social media and
online news portals allow information to spread rapidly, making it difficult to distinguish between authentic and
misleading content. The proposed system aims to detect fake news articles using Machine Learning techniques.
The system uses Natural Language Processing (NLP) and Machine Learning algorithms to classify news as
Real or Fake. The input news text is preprocessed, converted into numerical vectors using TF-IDF
vectorization, and classified using Machine Learning classification algorithm called Logistic Regression.
The project uses both global and local news datasets for training the model. The trained model achieved an
accuracy of approximately 98%, showing effective performance in identifying fake news patterns.
This system can help users verify the authenticity of news articles and reduce the spread of misinformation.
Table of Contents
CERTIFICATE ...................................................................................................................................................... ii
DECLARATION................................................................................................................................................... iii
ACKNOWLEDGEMENT .................................................................................................................................... iv
ABSTRACT ............................................................................................................................................................ v
CHAPTER 1 ........................................................................................................................................................... 4
INTRODUCTION.................................................................................................................................................. 4
1.1 Introduction to Data Science ...................................................................................................................................... 4
1.2 Introduction to Machine Learning ............................................................................................................................ 4
1.3 Introduction to Deep Learning ................................................................................................................................. 5
CHAPTER 2 ........................................................................................................................................................... 6
HARDWARE AND SOFTWARE SPECIFICATIONS ..................................................................................... 6
2.1 Software specification ................................................................................................................................................. 6
1. Project Overview ......................................................................................................................................................... 6
2. Development Environment ......................................................................................................................................... 6
3. Libraries and Frameworks ........................................................................................................................................... 6
4. Data Collection ............................................................................................................................................................ 7
2.2 Hardware specification ............................................................................................................................................... 7
CHAPTER 3 ........................................................................................................................................................... 8
SYSTEM ANALYSIS ............................................................................................................................................ 8
1. Requirements............................................................................................................................................................ 8
Functional Requirements: ............................................................................................................................................... 8
Non-functional Requirements:......................................................................................................................................... 9
2. Data Flow Analysis ....................................................................................................................................................... 9
3. System Architecture.................................................................................................................................................... 10
4. Challenges and Constraints........................................................................................................................................ 10
5. Risk Assessment and Mitigation ................................................................................................................................ 10
CHAPTER 4 ......................................................................................................................................................... 11
FEASIBILITY STUDY ....................................................................................................................................... 11
1. Technical Feasibility ................................................................................................................................................... 11
2. Economic Feasibility ................................................................................................................................................... 11
3. Legal Feasibility .......................................................................................................................................................... 12
CHAPTER- 5 ........................................................................................................................................................ 13
ANALYSIS ........................................................................................................................................................... 13
Project Goals and Objectives ......................................................................................................................................... 13
Data Requirements ......................................................................................................................................................... 13
System Architecture........................................................................................................................................................ 14
CHAPTER 6 ......................................................................................................................................................... 15
SOFTWARE ENGINEERING PARADIGMS ................................................................................................. 15
6.1 SYSTEM DEVELOPMENT LIFE CYCLE ........................................................................................................... 16
CHAPTER 7 ......................................................................................................................................................... 19
SYSTEM DESIGN ............................................................................................................................................... 19
1. Data Layer ....................................................................................................................... Error! Bookmark not defined.
2. Data Processing and Preprocessing Layer .................................................................... Error! Bookmark not defined.
3. Machine Learning Layer ................................................................................................ Error! Bookmark not defined.
4. Prediction and Alert Layer ............................................................................................ Error! Bookmark not defined.
5. Interface Layer ................................................................................................................ Error! Bookmark not defined.
6. Model Retraining and Feedback Loop .......................................................................... Error! Bookmark not defined.
7. System Architecture Diagram (Conceptual) ................................................................ Error! Bookmark not defined.
8. Security Measures ........................................................................................................... Error! Bookmark not defined.
9. Scalability and Cloud Integration ................................................................................. Error! Bookmark not defined.
CHAPTER 8 ......................................................................................................... Error! Bookmark not defined.
PHOTOS ............................................................................................................... Error! Bookmark not defined.
CHAPTER 9 ......................................................................................................................................................... 23
Modules ................................................................................................................. Error! Bookmark not defined.
CHAPTER 10 ....................................................................................................... Error! Bookmark not defined.
VALIDATION CHECKS .................................................................................... Error! Bookmark not defined.
1. Data Validation ............................................................................................................... Error! Bookmark not defined.
2. Feature Engineering Validation .................................................................................... Error! Bookmark not defined.
3. Model Training and Validation Checks ........................................................................ Error! Bookmark not defined.
4. Performance Metrics Validation ................................................................................... Error! Bookmark not defined.
5. Real-Time Validation Checks (for Deployment) .......................................................... Error! Bookmark not defined.
6. User Interface and Alert System Validation ................................................................. Error! Bookmark not defined.
7. Model Retraining and Drift Monitoring Validation .................................................... Error! Bookmark not defined.
8. Security and Compliance Validation............................................................................. Error! Bookmark not defined.
CHAPTER 11 ....................................................................................................... Error! Bookmark not defined.
TESTING .............................................................................................................. Error! Bookmark not defined.
[Link] Testing ...................................................................................................................... Error! Bookmark not defined.
2. Integration Testing.......................................................................................................... Error! Bookmark not defined.
3. Model Testing .................................................................................................................. Error! Bookmark not defined.
4. Regression Testing .......................................................................................................... Error! Bookmark not defined.
CHAPTER 12 ....................................................................................................... Error! Bookmark not defined.
MAINTENANCE ................................................................................................. Error! Bookmark not defined.
1. Monitoring and Performance Evaluation ..................................................................... Error! Bookmark not defined.
2. Model Updates and Retraining ...................................................................................... Error! Bookmark not defined.
3. Data Management ........................................................................................................... Error! Bookmark not defined.
4. System Updates and Improvements .............................................................................. Error! Bookmark not defined.
5. User Support and Training ............................................................................................ Error! Bookmark not defined.
6. Documentation Updates ................................................................................................. Error! Bookmark not defined.
7. Compliance and Audit Reviews ..................................................................................... Error! Bookmark not defined.
8. Performance Review Meetings ...................................................................................... Error! Bookmark not defined.
CHAPTER 13 ....................................................................................................................................................... 33
SYSTEM SECURITY MEASURES .................................................................................................................. 33
1. Data Encryption .......................................................................................................................................................... 33
2. Access Control ............................................................................................................................................................. 33
3. User Authentication and Authorization .................................................................................................................... 33
4. Data Integrity Checks ................................................................................................................................................. 33
5. Network Security ........................................................................................................................................................ 34
6. Vulnerability Management ........................................................................................................................................ 34
7. Data Masking and Anonymization ............................................................................................................................ 34
CHAPTER 14 ....................................................................................................................................................... 35
FUTURE SCOPE OF THE PROJECT ............................................................................................................. 35
1. Advanced Machine Learning Techniques ................................................................................................................ 35
2. Real-Time Processing and Automation ..................................................................................................................... 35
3. Integration of Alternative Data Sources ................................................................................................................... 35
4. Anomaly Detection Enhancements ............................................................................................................................ 35
5. Improved User Experience ......................................................................................................................................... 35
6. Mobile and IoT Integration ........................................................................................................................................ 36
7. Enhanced Explainability and Transparency ............................................................................................................ 36
8. Collaborative Fraud Detection .................................................................................................................................. 36
CHAPTER 15 ....................................................................................................................................................... 38
REFERENCES ..................................................................................................................................................... 38
CHAPTER 1
INTRODUCTION
a. Data Collection: Gathering data from various sources, such as databases, sensors, web scraping, and
more.
b. Data Cleaning and Preprocessing: Preparing and cleaning data to remove errors, missing values, and
inconsistencies.
c. EDA: Visualizing and exploring data to understand patterns, relationships, and potential insights.
d. Statistical Analysis: Applying statistical techniques to uncover correlations and patterns in th
e. Machine Learning: Utilizing machine learning algorithms to build predictive models and make data-
driven decisions.
f. Data Visualization: Creating visual representations of data to communicate findings effectively.
g. Domain Knowledge: Incorporating expertise in the specific field to interpret results and draw
meaningful conclusions.
a. Feature Engineering: Selecting and transforming the most relevant data attributes for training the
model.
b. Supervised Learning: Training models with labeled data, where the correct outcomes are provided, to
make predictions.
c. Unsupervised Learning: Discovering patterns and structures in unlabeled data, such as clustering and
dimensionality reduction.
d. Reinforcement Learning: Training agents to make sequences of decisions to maximize a reward, often
used in robotics and gaming.
e. Model Evaluation: Assessing the performance of machine learning models using various metrics like
accuracy, precision, recall, and F1 score.
f. Model Deployment: Implementing trained models in real-world applications to make predictions or
automate decision-making.
a. Text Preprocessing: NLP removes unnecessary words, symbols, and stopwords to clean the news
content for analysis.
b. Tokenization and Feature Extraction: It breaks text into smaller units (tokens) and extracts important
keywords and phrases.
c. Sentiment Analysis: NLP identifies emotional or biased language often found in fake news articles .
d. Text Classification: Using machine learning algorithms, NLP helps classify news content as real or fake
based on linguistic patterns.
Fake News Detection is the process of identifying false, misleading, or manipulated information shared through
digital platforms such as social media, websites, blogs, and online news channels. With the rapid growth of the
internet and social networking sites, fake news spreads quickly and influences public opinion, politics, business,
and society. A Fake News Detection System analyzes the content, writing style, keywords, and source
credibility of news articles to determine whether the information is genuine or fake. These systems help reduce
the spread of misinformation, improve the reliability of online content. Key Points include:
1. Project Overview
Fake news detection using Logistic Regression involves training a model on news datasets to classify news
articles as fake or genuine. The model analyzes various textual features such as headlines, keywords, and
writing patterns to identify hidden patterns in the content. Logistic Regression helps in predicting the
probability of news being fake or real with high efficiency and reduced complexity, ultimately improving the
accuracy of misinformation detection with minimal errors.
2. Development Environment
a. Operating System: The project was developed on Windows 10, ensuring compatibility with the
required libraries and development tools.
b. Programming Language: Python The primary language for developing the ML model, HTML,CSS
were used for developing frontend.
c. Integrated Development Environment (IDE): Visual Studio Code (VS Code). This IDE was used for
writing and debugging the Python code, providing features like code completion, syntax highlighting,
extensions support, and an integrated terminal for efficient development and testing.
4. Data Collection
Data Source:-
Kaggle datasets: Data of Real and Fake News were collected from Google [Link] to create a
diverse and comprehensive [Link] with that a dataset of local Indian News was also used in
traning and testing of Model.
1. Processor: Quad-core CPU (Intel i7 or Ryzen 5/7) for faster data handling and computation.
2. RAM: 4GB or more,
3. Storage: 256GB HDD/SDD
CHAPTER 3
SYSTEM ANALYSIS
System analysis refers to the process of examining a business situation with the intent of improving it through
better procedures and methods. Systems development can generally be thought of as having two major
components: System Analysis and Systems Design. System design is the process of planning a new system or
replace or complement an existing system. But before this planning can be done, we must thoroughly
understand the existing system and determine how computers can best be used to make its operation more
effective. Systems analysis, then, is the process of gathering and interpreting facts, diagnosing problems and
using the information to recommend improvement to the system. In brief, we can say that analysis specifies
what the system should do. System design states how to accomplish the objective. Thus, systems analysis is a
management technique which helps us in designing a new system or improving an existing system.
1) Requirements
Functional Requirements:
o Data Collection: Collect fake and real news articles from global and local datasets. The
collected data includes news title, article text, category, and labels indicating whether the news is
real or fake.
o Feature Extraction: The system converts textual data into numerical vectors using TF-IDF
(Term Frequency–Inverse Document Frequency). Important keywords and textual patterns are
extracted for effective classification.
o Model Building and Optimization: The Logistic Regression classifier is trained using TF-IDF
feature vectors. Hyperparameter tuning and train-test splitting are performed to improve
prediction accuracy and model performance.
o Evaluation Metrics: The model is evaluated using performance metrics such as Accuracy,
Precision, Recall, F1-score, and Confusion Matrix to ensure reliable fake news classification.
o Prediction and Deployment: The system predicts whether the entered news article is Fake or
Real through a Flask-based web interface. The trained model and vectorizer are saved for future
predictions and deployment.
Non-functional Requirements:
o Performance: The system should provide fast and accurate predictions with minimal processing
delay.
o Scalability: The system should support large datasets and future integration of additional
regional datasets.
o Maintainability: The system should allow future updates, retraining, and integration of
advanced Machine Learning or Deep Learning models.
o Reliability The prediction system should maintain consistent accuracy and stable performance
during testing and deployment.
o Usability: The web interface should be simple, user-friendly, and easy to access by users with
minimal technical knowledge.
Feature Extration: TF-IDF vectorization converts textual data into numerical vectors that can be
processed by the Machine Learning model.
Model Training and Evaluation: The Logistic Regression model is trained using labelled datasets. The
dataset is divided into training and testing sets to evaluate prediction performance.
Prediction and Result Generation: User-input news text is transformed using the trained vectorizer
and passed to the model for classification. The result is displayed as Fake News or Real News.
3. System Architecture
Data Layer: This layer contains global and local datasets stored in CSV format along with saved
machine learning model files.
Processing Layer: This layer performs text cleaning, tokenization, stop-word removal, and data
normalization. TF-IDF vectorization converts textual information into numerical feature vectors.
Machine Learning Layer: Logistic Regression is used for training and classification of fake and real
news articles.
Interface Layer: A Flask-based web interface allows users to enter news text and view prediction
results.
Regional News Variations: Local news articles may contain regional vocabulary and writing styles that
differ from global datasets.
Computational Constraints: Training large textual datasets on systems with limited RAM and
processing power may affect performance.
Evolving Fake News Pattern : Fake news styles and misinformation techniques continuously change,
requiring regular dataset updates and retraining.
Short Headlines: Fake news headlines with limited textual context may reduce prediction reliability.
Dataset Bias: Bias in global or regional datasets may impact prediction performance. Combining
multiple datasets helps improve generalization.
Model Drift: Fake news trends evolve over time. Periodic retraining with updated datasets helps
maintain accuracy.
CHAPTER 4
FEASIBILITY STUDY
The feasibility study evaluates the practicality and effectiveness of implementing the Fake News Detection
System using Machine Learning techniques.
1. Technical Feasibility
Availability of Technology: The project uses widely available technologies such as Python, Flask,
Scikit-learn, Pandas, and TF-IDF vectorization. These technologies are open-source and suitable for
Machine Learning-based text classification.
Dataset Availability: Large global fake and real news datasets are publicly available through Kaggle
and other online sources. Local Indian news datasets were also incorporated to improve regional
prediction capability.
Skillset Availability: Basic knowledge of Python programming, Machine Learning, and Natural
Language Processing is sufficient to develop and maintain the system.
Conclusion: The project is technically feasible due to the availability of required technologies, datasets, and
development tools.
2. Economic Feasibility
Initial Investment: The project requires minimal financial investment because all software libraries and
frameworks used are open-source.
Operational Costs: The operational cost is low since the system can run on standard personal
computers without specialized hardware.
Maintenance Costs: Periodic dataset updates and model retraining may be required, but overall
maintenance expenses remain affordable.
Benefits: The system helps users identify fake news quickly and reduces the spread of misinformation,
providing social and informational benefits.
Conclusion: The project is economically feasible due to low development and maintenance costs.
3. Legal Feasibility
Data Privacy and Usage: The project uses publicly available datasets and news articles for educational
and research purposes.
Compliance: The system does not store sensitive personal user information and follows ethical usage of
publicly available data
Content Responsibility: Prediction results are generated for informational purposes and should not be
considered official verification.
Conclusion: The project is legally feasible provided datasets are used responsibly and ethically.
4. Operational Feasibility
Ease of Use : The Flask-based web interface allows users to easily enter news articles and receive
prediction results.
System Integration: The system can be integrated into websites, social media platforms, or browser
extensions in future implementations.
Scalability: The model can be retrained using updated datasets and enhanced with advanced Machine
Learning or Deep Learning techniques.
Conclusion: The project is operationally feasible due to its user-friendly design and adaptability.
5. Scheduling Feasibility
Project Timeline: The project can be completed within approximately 1 to 2 months, including dataset
collection, preprocessing, model training, testing, and deployment.
Dependencies: Project progress depends on dataset availability, system resources, and model training
performance.
Testing and Deployment: Multiple testing phases are conducted using global and local news articles
before final deployment.
Conclusion: The project is scheduling feasible because all development phases can be completed within the
planned academic timeline.
CHAPTER- 5
ANALYSIS
The Fake News Detection System using Machine Learning focuses on analysing news articles and classifying
them as Fake or Real. The system helps users identify misleading information and reduces the spread of
misinformation on digital platforms. Here’s a breakdown of key components and analysis:
2) Data Requirements
The project requires both fake and real news datasets for training and testing the Machine Learning model.
Global Dataset
i. [Link]
ii. [Link]
These datasets contain thousands of international fake and real news articles.
Local Dataset
i. local_true.csv
ii. local_fake.csv
These datasets contain Indian news articles and fake news headlines to improve regional prediction capability.
Data Attributes
News title
News article text
Labels indicating Fake or Real news
Lowercase conversion
Removal of punctuation marks
Stop-word removal
Tokenization
Text normalization
System Architecture
The architecture of the Fake News Detection System consists of multiple layers:
Data Layer: This layer stores global and local news datasets in CSV format along with trained Machine
Learning model files and vectorizer files.
Processing Layer: This layer performs text cleaning, tokenization, stop-word removal, and data
[Link] processing layer converts textual data into numerical feature vectors suitable for
Machine Learning algorithms. TF-IDF vectorization converts textual information into numerical feature
vectors.
Machine Learning Layer: Logistic Regression is used for model training, classification of fake and
real news articles, prediction generation and accuracy anylysis.
Interface Layer: A Flask-based web interface allows users to enter news text and view prediction
results.
CHAPTER 6
A software engineering paradigm, also known as a software development paradigm or software development
methodology, is a standardized and systematic approach to the software development process. It encompasses a
set of principles, practices, and techniques used to design, develop, test, deploy, and maintain software systems.
These paradigms provide a structured framework for managing the complexities of software development and
have evolved over time to address various challenges and requirements. Some of the prominent software
engineering paradigms include:
1) Waterfall Model: The Waterfall model is a linear and sequential approach to software development. It
consists of discrete phases, such as requirements analysis, design, implementation, testing, deployment,
and maintenance, with each phase building on the previous one. Once a phase is completed, development
moves to the next phase. The Waterfall model is suited for projects with well-defined and stable
requirements.
2) Agile Methodology: Agile is an iterative and incremental approach that emphasizes flexibility,
collaboration, and customer feedback. It comprises various methodologies, including Scrum, Kanban,
and Extreme Programming (XP). Agile development divides the project into small, manageable units and
allows for changes in requirements and priorities throughout the development process.
3) Iterative and Incremental Development: This paradigm involves repeatedly developing and refining
the software through a series of iterations or increments. Each iteration builds upon the previous one,
allowing for ongoing improvement and the incorporation of new features or changes.
4) Spiral Model: The Spiral model is a risk-driven approach that combines elements of the Waterfall and
iterative paradigms. It involves risk assessment and mitigation in each phase of development, making it
suitable for projects with evolving requirements and where managing risks is critical.
5) V-Model (Verification and Validation Model): The V-Model extends the Waterfall model by
emphasizing verification and validation activities in parallel with each development phase. It ensures that
testing and quality assurance activities are integrated from the beginning of the project.
6) Rapid Application Development (RAD): RAD is an iterative model that focuses on rapid prototyping
and user feedback. It is well-suited for projects where speed and user involvement are crucial, such as
developing prototypes and proof-of-concept applications.
For the Fake News Detection System, the Agile Software Development Model was selected because it supports
incremental development, continuous testing, and flexibility during implementation.
The Agile Model is an iterative and incremental software development approach in which the project is divided
into smaller development phases. Each phase includes planning, development, testing, and improvement.
Unlike traditional software development methods, Agile allows continuous modifications and improvements
during development. This makes it suitable for Machine Learning projects where experimentation and repeated
testing are important.
In the Fake News Detection System, multiple stages of development were carried out iteratively. The project
initially started with basic dataset collection and model training. During development, improvements such as
local dataset integration, dataset optimization, frontend enhancement, and model retraining were performed
continuously.
The Agile model allowed flexibility in modifying datasets, changing preprocessing techniques, and improving
prediction accuracy throughout the development lifecycle.
Agile Development Phases in the Project:
1. Requirement Analysis
In this phase, the project objectives and requirements were identified. The need for detecting fake news using
Machine Learning techniques was analysed.
2. Dataset Collection
Global and local news datasets were collected from multiple sources. Fake and real news articles were
organized and labelled for training purposes.
3. Data Preprocessing
The collected textual data was cleaned and processed by removing punctuation marks, stop words, and
unwanted symbols. Text normalization techniques were also applied.
4. Feature Extraction
TF-IDF vectorization was implemented to convert textual data into numerical feature vectors suitable for
Machine Learning algorithms.
5. Model Development
The Logistic Regression algorithm was selected and trained using the processed dataset. Different training
configurations and dataset combinations were tested to improve prediction accuracy.
The model was evaluated using testing datasets and performance metrics such as Accuracy, Precision, F1-score.
A Flask-based web interface was developed to allow users to input news articles and receive prediction results.
Additional local datasets were integrated to improve prediction performance on regional news articles. Model
retraining and optimization were performed iteratively.
Advantages of Agile Model
Conclusion
The Agile Software Development Model proved suitable for the Fake News Detection System because it
supported iterative development, continuous testing, and flexibility throughout the project lifecycle. The model
enabled efficient implementation, debugging, optimization, and enhancement of the Machine Learning system.
CHAPTER 7
SYSTEM DESIGN
The System Design of the Fake News Detection System describes the overall structure and functioning of the
proposed system. The system is designed using multiple layers, where each layer performs a specific task in the
fake news detection process.
The architecture follows a modular approach, making the system efficient, scalable, and easy to maintain.
The Data Collection Layer is responsible for gathering fake and real news datasets from various global and
local sources.
The datasets are collected in CSV format and contain attributes such as:
News title
News article text
Labels indicating fake or real news
This layer ensures that sufficient and diverse training data is available for effective Machine Learning model
[Link] collected datasets are combined and shuffled before preprocessing and training.
The Text Preprocessing Layer cleans and prepares textual data for Machine Learning processing.
punctuation marks
special symbols
stop words
unwanted spaces
inconsistent formatting
Lowercase conversion
Removal of punctuation marks
Stop-word removal
Tokenization
Text normalization
These preprocessing steps help improve the quality of textual data and increase model [Link] cleaned
text becomes suitable for feature extraction and classification.
Machine Learning models cannot directly understand textual data. Therefore, the cleaned text must be
converted into numerical form.
TF-IDF measures the importance of words in a document relative to the entire dataset.
This layer transforms news articles into machine-readable numerical representations that can be processed by
the classification model.
To optimize memory usage and improve performance, feature limits and preprocessing optimizations were
applied during vectorization.
The Machine Learning Layer is the core component of the Fake News Detection System.
The Logistic Regression classifier is trained using TF-IDF feature vectors generated from the news dataset.
Dataset splitting
Model training
Prediction generation
Performance evaluation
Accuracy optimization
Training Dataset
Testing Dataset
The model learns textual patterns associated with fake and real news articles during training.
The model is saved using Pickle for future predictions and deployment.
The Prediction Layer is responsible for classifying user-input news articles as Fake or Real.
Fake News
or
Real News
This layer provides fast and efficient prediction results for users.
The Web Interface Layer provides interaction between the user and the Machine Learning system.
The interface is simple, lightweight, and user-friendly. The web application connects the frontend with the
backend Machine Learning model and enables real-time fake news detection through a browser interface. This
layer improves usability and makes the system accessible to non-technical users.
Conclusion
The System Design of the Fake News Detection System follows a layered architecture consisting of data
collection, preprocessing, feature extraction, Machine Learning classification, prediction, and user interface
layers. This modular design improves maintainability, scalability, efficiency, and overall system performance
while enabling accurate fake news detection.
CHAPTER 9
IMPLIMENTATION
8.1 Libraries
CODE:
import pandas as pd
import pickle
The project uses both global and local datasets for fake news detection. The global datasets include [Link]
and [Link], while the local datasets include local_fake.csv and local_true.[Link] were assigned
as:
Fake News → 0
Real News → 1
The title and text columns were combined into a single content column. All datasets were merged into one
dataframe using Pandas and shuffled before training.
CODE:
fake_df = pd.read_csv("[Link]")
true_df = pd.read_csv("[Link]")
fake_df['label']=0
true_df['label']=1
fake_df['content']=fake_df['title']+" "+fake_df['text']
true_df['content']=true_df['title']+" "+true_df['text']
local_fake=pd.read_csv("local_fake.csv")
local_true=pd.read_csv("local_true.csv")
local_fake['label']=0
local_true['label']=1
local_fake['content']=local_fake['title']+" "+local_fake['text']
local_true['content']=local_true['title']+" "+local_true['text']
df=[Link]([fake_df,true_df,local_fake,local_true],ignore_index=True)
df= df[['content','label']]
df=[Link]()
df=[Link](frac=1,random_state=42)
The textual data was converted into numerical form using TF-IDF (Term Frequency–Inverse Document
Frequency) vectorization. TF-IDF helps identify important words in news articles while reducing the impact of
commonly used words.
The dataset was divided into training and testing sets using the train-test split method. Logistic Regression was
used as the Machine Learning algorithm for classification.
The model was trained using TF-IDF feature vectors and achieved high prediction accuracy.
CODE:-
X_train,X_test,y_train,y_test = train_test_split(
df['content'],
df['label'],
test_size=0.2,
random_state=42,
stratify=df['label'])
vectorizer = TfidfVectorizer(
stop_words='english',
max_features=5000,
max_df=0.8,
min_df=5)
X_train_tfidf = vectorizer.fit_transform(X_train)
X_test_tfidf = [Link](X_test)
model =LogisticRegression(max_iter=2000)
[Link](X_train_tfidf,y_train)
The trained model was tested using unseen testing data to evaluate prediction performance. Accuracy score was
used to measure the effectiveness of the [Link] system achieved approximately 98% accuracy.
CODE:
y_pred =[Link](X_test_tfidf)
print("Accuracy:",accuracy_score(y_test,y_pred))
OUTPUT:
8.5 Model Saving Using Pickle:
After successful training and testing, the trained Logistic Regression model and TF-IDF vectorizer were saved
using the Pickle library. This allows the model to be reused later in the Flask web application without retraining.
CODE:
[Link](model,open("[Link]","wb"))
[Link](vectorizer,open("[Link]","wb"))
A Flask-based web application was developed to provide a user-friendly interface for fake news detection. The
Flask backend connects the trained Machine Learning model with the frontend interface.
The application accepts user-input news text, processes it using the TF-IDF vectorizer, and predicts whether the
news is Fake or Real.
import pickle
model = [Link](open("[Link]","rb"))
vectorizer=[Link](open("[Link]","rb"))
app= Flask(__name__)
@[Link]('/')
def home():
return render_template('[Link]')
@[Link]('/predict',methods=['POST'])
def predict():
news=[Link]['news']
news_vector=[Link]([news])
prediction=[Link](news_vector)
if prediction[0]==0:
result="Fake News"
else:
result="Real News"
return render_template('[Link]',prediction=result)
if __name__=='__main__':
[Link](debug=True)
The frontend interface was developed using HTML and CSS. The interface allows users to enter news text and
view prediction results in a simple and interactive format.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
.container {
background: white;
border-radius: 15px;
width: 100%;
max-width: 600px;
text-align: center;
h2 {
margin-bottom: 20px;
color: #333;
textarea {
width: 100%;
padding: 12px;
border-radius: 8px;
font-size: 14px;
resize: none;
transition: 0.3s;
textarea:focus {
border-color: #667eea;
outline: none;
transform: scale(1.02);
button {
margin-top: 15px;
border: none;
border-radius: 25px;
color: white;
font-size: 16px;
cursor: pointer;
transition: all 0.3s ease;
button:hover {
transform: translateY(-3px);
.result {
margin-top: 20px;
padding: 12px;
border-radius: 10px;
font-weight: bold;
.real {
background-color: #d4edda;
color: #155724;
.fake {
background-color: #f8d7da;
color: #721c24;
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
to {
opacity: 1;
transform: translateY(0);
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(30px);
to {
opacity: 1;
transform: translateY(0);
</style>
</head>
<body>
<div class="container">
<br>
</form>
{% if prediction %}
Result: {{ prediction }}
</div>
{% endif %}
</div>
</body>
</html>
OUTPUT:
CHAPTER 13
Implementing robust security measures is critical for the integrity, confidentiality, and availability of a
credit card fraud detection system. Below are key security measures that should be integrated into the system:
1. Data Encryption
In Transit: Use encryption protocols (e.g., TLS/SSL) to protect data transmitted between users and the
data and functionalities necessary for their roles. For example, fraud analysts should have different
permissions than system administrators.
Multi-Factor Authentication (MFA): Require MFA for all user accounts, especially those with access
to sensitive data or system functionalities, to enhance security against unauthorized access.
3. User Authentication and Authorization
Strong Password Policies: Enforce strong password requirements (e.g., length, complexity) and regular
The future scope of a credit card fraud detection system using Random Forest and similar technologies
is vast, with numerous opportunities for enhancement and innovation. Here are some key areas for future
development:
(GBM) or XGBoost, which might offer improved performance over Random Forest.
Deep Learning: Integrate deep learning approaches, such as neural networks, for feature extraction and
pattern recognition, especially in high-dimensional data.
2. Real-Time Processing and Automation
Stream Processing: Implement stream processing frameworks (e.g., Apache Kafka, Apache Flink) to
handle real-time transaction data, allowing immediate fraud detection and response.
Automated Response Systems: Develop automated systems that can block or flag suspicious
transactions in real-time, reducing the response time to potential fraud.
3. Integration of Alternative Data Sources
Behavioural Biometrics: Incorporate user behavioural data (e.g., typing speed, mouse movement) to
patterns without the need for labeled data, which can enhance the detection of new fraud techniques.
Clustering Techniques: Use clustering algorithms (e.g., K-means, DBSCAN) to group similar
transactions, making it easier to identify outliers that may indicate fraud.
5. Improved User Experience
User Feedback Mechanism: Develop systems to collect and analyze user feedback on alerts and
transactions, improving the model and user interface based on real-world experiences.
Customizable Alerts: Allow users to customize alert settings, such as thresholds for suspicious
transactions, enhancing user satisfaction and trust.
6. Mobile and IoT Integration
Mobile Application Development: Create mobile apps for real-time alerts and transaction monitoring,
REFERENCES
1. [Link]
2. [Link]
3. [Link]