https://github.com/githubasr2001/fake_classifier
https://github.com/githubasr2001/fake_classifier
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/githubasr2001/fake_classifier
- Owner: githubasr2001
- Created: 2023-10-22T02:38:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-22T02:55:51.000Z (over 1 year ago)
- Last Synced: 2023-10-22T03:28:03.605Z (over 1 year ago)
- Language: Jupyter Notebook
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```markdown
# Fake News ClassifierThis repository contains code for a text classification project using Python and the scikit-learn library. The project involves reading a dataset from a CSV file, preprocessing the text data, and building a machine learning model to classify the text into different categories.
## Dataset
The dataset used in this project is stored in the 'train.csv' file. It is a labeled dataset where each text entry is associated with a 'label' that represents its category.## Dependencies
- pandas
- scikit-learn
- nltk
- reYou can install these dependencies using `pip`:
```
pip install pandas scikit-learn nltk
```## Code Overview
- `read_csv` - Reads the dataset from 'train.csv' using the pandas library.
- Data Preprocessing:
- Extracts independent (X) and dependent (Y) features.
- Performs data cleaning, removing any rows with missing values.
- Tokenizes, lowers case, and stems the text data using the NLTK library.
- Feature Extraction:
- Uses the CountVectorizer from scikit-learn to convert the text data into a numerical format.
- Train-Test Split:
- Splits the dataset into training and testing sets using `train_test_split` from scikit-learn.
- `get_feature_names_out` - Gets feature names from the CountVectorizer.
- `get_params` - Gets parameters used in the CountVectorizer.
- `count_df` - Creates a DataFrame of the training data with feature names.## Acknowledgments
- [Pandas](https://pandas.pydata.org/)
- [scikit-learn](https://scikit-learn.org/stable/)
- [NLTK](https://www.nltk.org/)