Skip to content

Commit 2b5928b

Browse files
authored
Merge pull request #1484 from PrAyAg9/main
#1483 Solved - Added Fake News Detection
2 parents a1f4ec8 + 5c4fcaa commit 2b5928b

File tree

3 files changed

+12039
-0
lines changed

3 files changed

+12039
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Fake News Detection using CNN
2+
3+
This project implements a Convolutional Neural Network (CNN) to detect and classify fake news articles from textual data. The dataset used consists of labeled news articles, categorized as either real or fake, and is obtained from various sources including Kaggle. The implementation is done in Python using popular machine learning libraries.
4+
5+
## Table of Contents
6+
- [Project Overview](#project-overview)
7+
- [Dataset](#dataset)
8+
- [Installation](#installation)
9+
- [Usage](#usage)
10+
- [Model Architecture](#model-architecture)
11+
- [Training](#training)
12+
- [Evaluation](#evaluation)
13+
- [Results](#results)
14+
15+
## Project Overview
16+
The goal of this project is to detect fake news using a Convolutional Neural Network (CNN). The model is trained on a dataset of news articles labeled as real or fake. This project demonstrates the process of loading the dataset, preprocessing the text, building the model, training the model, and evaluating its performance.
17+
18+
## Dataset
19+
The dataset used in this project is from Kaggle and contains thousands of labeled news articles. You can download the dataset from [here](https://www.kaggle.com/c/fake-news).
20+
21+
## Installation
22+
To run this project, you need to have the following dependencies installed:
23+
24+
- Python 3.x
25+
- TensorFlow
26+
- Keras
27+
- NumPy
28+
- Pandas
29+
- Scikit-learn
30+
- Matplotlib
31+
32+
You can install the necessary packages using the following commands:
33+
34+
```bash
35+
pip install tensorflow keras numpy pandas scikit-learn matplotlib
36+
```
37+
Usage
38+
Clone the repository:
39+
```bash
40+
git clone https://github.com/recodehive/machine-learning-repos/Fake-News-Detection.git
41+
cd Fake-News-Detection
42+
```
43+
## Model Architecture
44+
The model is a Convolutional Neural Network (CNN) with the following architecture:
45+
- Embedding layer for word representation
46+
- Convolutional layers to capture spatial hierarchies
47+
- MaxPooling layers to reduce dimensionality
48+
- Flatten layer to convert the 3D output to 1D
49+
- Fully connected (Dense) layers for classification
50+
- Output layer with a sigmoid activation function for binary classification
51+
52+
## Training
53+
The model is trained using the Adam optimizer and binary cross-entropy loss. The dataset is split into training and validation sets to monitor the performance of the model during training.
54+
55+
## Evaluation
56+
The model is evaluated on a separate test set to measure its accuracy. The evaluation results, including accuracy and loss, are printed to the console.
57+
58+
## Results
59+
The model achieves competitive accuracy on the test set. Training and validation accuracy can be visualized through plots generated during training.

0 commit comments

Comments
 (0)