This advanced python project of detecting fake news deals with fake and real news. Using sklearn, we build a TfidfVectorizer on our dataset. Then, we initialize a PassiveAggressive Classifier and fit the model. In the end, the accuracy score and the confusion matrix tell us how well our model fares.
Installations: You’ll need to install the following libraries with pip:
pip install numpy
pip install pandas
pip install sklearn
You’ll need to install Jupyter Lab to run your code. Get to your command prompt and run the following command:
C:\Users\sabiyatabassum>jupyter lab
Dataset:
The dataset we’ll use for this python project- we’ll call it news.csv. This dataset has a shape of 7796×4. The first column identifies the news, the second and third are the title and text, and the fourth column has labels denoting whether the news is REAL or FAKE. The dataset takes up 29.2MB of space and you can download it which is pinned below.
https://drive.google.com/file/d/1er9NJTLUA3qnRuyhfzuN0XUsoIC4a-_q/view
This project is created with the help of references. So credits to their respective owners.
Keep Learning!
For further queries, you can DM me on my instagram account @learnwithcodeeris or @im__sabiya.