This project aims to detect fake news based on text data using machine learning techniques. The model focuses on author names and news titles to classify news articles as either real or fake. The dataset used contains 20,800 entries with 5 attributes.
- Data Preprocessing: Cleaning and preparing text data, including removing stopwords and stemming using NLTK.
- Feature Extraction: Utilizes TF-IDF vectorization to convert text into numerical features.
- Model Training: Logistic Regression model trained on preprocessed data.
- Model Evaluation: Evaluates model accuracy and performance on test data.
- Rows: 20,800
- Attributes: 5 (Author, Title, Text, Label, etc.)
- Focus: Author name and title for prediction.
- Python (3.x)
- NumPy
- pandas
- re (Regular Expressions)
- NLTK (Natural Language Toolkit)
- Scikit-learn (TfidfVectorizer, Logistic Regression, train_test_split, accuracy_score)
- Open the Jupyter Notebook
fake_news_prediction.ipynb. - Follow the steps in the notebook to understand data preprocessing, feature extraction, and model training.
- Modify the notebook if needed for experimentation or use it as a base for similar projects.
- Achieved an accuracy of 97.91% on the test data.
- Data Preprocessing: Cleans the text data by removing punctuation, stopwords, and performing stemming to reduce words to their root forms.
- Feature Extraction: Converts the cleaned text data into numerical format using TF-IDF vectorization, which measures the importance of words.
- Model Training: Uses a Logistic Regression classifier to train on the extracted features and labels.
- Prediction: Predicts the label (real or fake) for new news titles and author names.
Feel free to fork this repository, create a new branch, and submit a pull request for any improvements.
- The dataset used in this project was sourced from https://kaggle.com/competitions/fake-news.
- Special thanks to the open-source community for providing useful tools and libraries.
