A type of yellow journalism, fake news encapsulates pieces of news that may be hoaxes and is generally spread through social media and other online media. This is often done to further or impose certain ideas and is often achieved with political agendas. Such news items may contain false and/or exaggerated claims, and may end up being viralized by algorithms, and users may end up in a filter bubble.
In order to tackle the above issue, this is a model that will help us detect fake news deals with fake and real news.
Just a small overview :-
-
Using sklearn I have built a
TfidfVectorizer
in our dataset. -
Then, I have initialized a
PassiveAggressiveClassifier
and fit the model. -
In the end, the
accuracy score
and theconfusion matrix
tells how well the model fares.
The data I used for training and testing is a csv file : news.csv