Fake and Real News Detection Using Python

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/347382399

Fake and Real News detection Using Python

Article in International Journal of Scientific Research in Science and Technology · June 2020
DOI: 10.32628/IJSRST207376

CITATION READS

1 2,069

2 authors, including:

Faizan Ahmed Khan


University of Central Punjab
10 PUBLICATIONS 62 CITATIONS

SEE PROFILE

All content following this page was uploaded by Faizan Ahmed Khan on 23 August 2022.

The user has requested enhancement of the downloaded file.


© 2020 | International Journal of Scientific Research in Science and Technology
IJSRST | Volume 7 | Issue 3 | Print ISSN: 2395-6011 | Online ISSN: 2395-602X
DOI : https://doi.org/10.32628/IJSRST207376
Fake and Real News detection Using Python
Fakhra Akhtar1, Faizan Ahmed Khan2, Muhammad Tauseef Hanif2
1
Faculty of Computer Science an Information Technology, RIPHA University Lahore, Pakistan
2
COMSATS University Islamabad, Lahore-Campus, Pakistan

ABSTRACT

In the digital age, fake news has become a well-known phenomenon. The spread of false evidence is often used
to confuse mainstream media and political opponents, and can lead to social media wars, hatred arguments and
debates.Fake news is blurring the distinction between real and false information, and is often spread on social
media resulting in negative views and opinions. Earlier Research describe the fact that false propaganda is used
to create false stories on mainstream media in order to cause a revolt and tension among the masses The digital
rights foundation DRF report, which builds on the experiences of 152 journalists and activists in Pakistan,
presents that more than 88 % of the participants find social media platforms as the worst source for information,
with Facebook being the absolute worst. The dataset used in this paper relates to Real and fake news detection.
The objective of this paper is to determine the Accuracy , precision , of the entire dataset .The results are
visualized in the form of graphs and the analysis was done using python.
The results showed the fact that the dataset holds 95% of the accuracy. The number of actual predicted cases
were 296. Results of this paper reveals that The accuracy of the model dataset is 95.26 % the precision results
95.79 % whereas recall and F-Measure shows 94.56% and 95.17% accuracy respectively.Whereas in predicted
models there are 296 positive attributes , 308 negative attributes 17 false positives and 13 false negatives. This
research recommends that authenticity of news should be analysed first instead of drafting an opinion, sharing
fake news or false information is considered unethical journalists and news consumers both should act
responsibly while sharing any news.
Keywords- Fake News Detection, Python, Accuracy

I. INTRODUCTION regarding fake & real. This propaganda is being


circulating around for many decades, today internet is
Fake news is a piece of information that consists of the latest source of information with the single click
planned misinformation, and it is circulated through you can see a massive information regarding any topic.
some medium, especially social media. The unverified Today in the era of tech revolution Things are moving
information is spread through traditional news in a different direction, fighting an utterly different
platforms, in the pursuit of some agendas, concerted war, and on an entirely different level. This fake news
efforts are designed to draft something out of nothing. is controlled by various masses and business tycoons
Whenever we think about fake news and misleading to fulfill political agenda and they are often perceived
information we consider mainstream media and social as one of the greatest threats to democracy,
network. After making necessary research on the independence and national interests.
defined topic we consider and built up any opinion,

IJSRST207376 | Accepted : 20 June 2020 | Published : 29 June 2020 | May-June-2020 [ 7 (3) : 423-428]
423
Fakhra Akhtar et al Int J Sci Res Sci Technol. May-June-2020; 7 (3) : 423-428

Facebook, the most popular social media platform, first approach is based on the idea of a representative
claims to have more than 1.23 billion daily active voter, is shown to be suitable to obtain a qualitative
users as of December 2016 (Facebook 2017). While it understanding of phenomena associated with fake
started as a site through which we can share personal news at a macroscopic level. Whereas The second
ideas and updates with friends, a survey carried out in approach, based on the idea of an election
the United States found that 44 percent of the microstructure, describes the collective behaviour of
population get their news from Facebook (Gottfried the electorate by modelling the preferences of
and Shearer 2016). Social media sites are not only individual voters. Results of their study shows that
marked by having a mass audience, they also facilitate the mere knowledge that pieces of fake news may be
speedy exchange and spread of information. in circulation goes a long way towards mitigating the
Unfortunately, they have also facilitated the spread of impact of fake news.(3) Monti at.el (2019). In their
wrong information. research consider social media as one of the main
news sources for millions of people around the globe
The first phase of the paper explains about literature
due to their low cost, and easy They used core
review regarding to the defined dataset i.e. fake news
algorithms of classical convolutional neural networks
detection The second phase deals with the
to graphs, activity, social graph, and news
methodology data analysis tool. The third part
propagation. Their model was trained and tested on
discusses the research results based on the detailed
news stories, verified by professional fact-checking
analysisFourth phase deals with Discussion,
organizations, that were spread on Twitter. Their
conclusion and references.
results showed that social network structure and
II. LITERATURE REVIEW propagation are important features allowing highly
(1)Balmau at el (2018). In their research describe the accurate Secondly they observed that fake news can
fact that Today’s social media platforms enable to be reliably detected a an early stage, after just a few
spread both authentic and fake news very quickly. hours of propagation. Third, they tested the aging of
They developed a mechanism to limit the spread of their model on training and testing data separated in
fake news which is not based on content, by using a time. (4) Vicario, at.el (2019) in their research
Bayesian approach they estimated the trustworthiness introduced a framework for promptly identifying
of future news items they also evaluated the polarizing content on social media and, thus,
effectiveness and overhead of this technique on a predicting future fake news topics. They validated the
large Twitter graph. They identified that more than performances of the proposed methodology on
99% of fake news items with no false positives. The amassive Italian Facebook dataset, showing that they
performance impact is very small: the induced are able to identify topics that are susceptible to
overhead on the 90th percentile latency is less than misinformation with 77% accuracy. They also able to
3%, and less than 8% on the throughput of user recognize fake news with 91% accuracy. Their results
operations.(2) Brody at el (2018) In their research concluded the fact that a series of characteristics
consider fake news as a danger to democracy. related to users’ behavior on online social media such
According to them until now there has been no clear as Facebook is an important step towards the
understanding of how to define fake news, and how mitigation of misinformation phenomena by
to model it Their paper addresses both these issues, supporting the identification of potential
.they used two approaches for the modelling of fake misinformation targets and thus the design of tailored
news and its impact in elections an referendums. The counter-narratives. (5) Kleinberg at. el (2017) in their

International Journal of Scientific Research in Science and Technology ( www.ijsrst.com) | Volume 7 | Issue 3
424
Fakhra Akhtar et al Int J Sci Res Sci Technol. May-June-2020; 7 (3) : 423-428

research describe the fact that the production of recently become an emerging research that is
misleading information in everyday access media attracting tremendous attention. They also describe
outlets such as social media feeds, news blogs, and the fact that Fake news detection on social media
online newspapers have made it challenging to presents unique characteristics and challenges that
identify trustworthy news sources, thus increasing make existing detection algorithms from traditional
the need for computational tools able to provide news media incentive or not applicable. Fake news
insights into the reliability of online content. They are intentionally written to mislead readers to believe
are basically focusing on the automatic identification false information, which makes it difficult and
of fake content in online news. They introduced two nontrivial to detect based on news content; They
novel datasets for the task of fake news detection, included auxiliary information, such as user social
covering seven different news domains. They also engagements on social media, to help make a
described the collection, annotation, and validation determination. Second, exploiting this auxiliary
process in detail and presented several exploratory information is challenging in and of itself as users'
analyses on the identification of linguistic differences social engagements with fake news produce data that
in fake and legitimate news content. Secondly, they is big, incomplete, unstructured, and noisy. Because
conducted a set of learning experiments to build the issue of fake news detection on social media is
accurate fake news detectors. In addition, they both challenging and relevant, we conducted this
provided a comparative analyses of the automatic and survey to further facilitate research on the problem.
manual identification of fake news. Furthermore, They presented a comprehensive review of detecting
they also addressed the task of automatic fake news on social media, including fake news
identification of fake news. They introduced two new characterizations on psychology and social theories,
fake news datasets, one obtained through existing algorithms from a data mining perspective,
crowdsourcing and covering six news domains, and evaluation metrics and representative datasets. They
another one obtained from the web covering also discussed related research areas, open problems,
celebrities. They developed classification models that and future research directions for fake news detection
rely on a combination of lexical, syntactic, and on social media.
semantic information, as well features representing
III. METHODOLOGY
text readability properties. The results of their model
showed that they Our best performing achieved Artificial intelligence is considered as a use of
accuracies that are comparable to human ability to computerized reasoning (AI) It centers around the
spot fake content. (6) Wang at. el (2017) In their advancement of computer programs that can get to
research consider Social media for news consumption information and use it for themselves for the purpose
as a double-edged sword. On the one hand, its low of decision making in this research the dataset is
cost, easy access, and rapid dissemination of interpreted and analyzed using Python.
information lead people to seek out and consume
news from social media. On the other hand, it enables The Data
the wide spread of fake news", i.e., low quality news
The dataset used in this research paper is denoted by
with intentionally false information. The extensive
news.csv. It has a shape of 7796×4. The first column
spread of fake news has the potential for extremely
identifies the news, the second and third are the title
negative impacts on individuals and society.
Therefore, fake news detection on social media has

International Journal of Scientific Research in Science and Technology ( www.ijsrst.com) | Volume 7 | Issue 3
425
Fakhra Akhtar et al Int J Sci Res Sci Technol. May-June-2020; 7 (3) : 423-428

and text, and the fourth column has labels denoting 95.26 % the precision results 95.79 % whereas recall
whether the news is REAL or FAKE and F-Measure shows 94.56% and 95.17% accuracy
respectively.
PYTHON

Python is a suitable language for both learning and Table 2 predicted class results
real world programming. It is a powerful high-level,
object-oriented programming language created by
Model Prediction Prediction
Guido van Rossum and is also known to have a great
Yes No
quantity of libraries that assist with data analysis &
Actual Yes 296 17
scientific computing. It is a very high-level language
and has many sources for learning. It supports a wide Class No 13 308
variety of third party tools which makes it much easier
to use and motivates the users to continue with, Table 2 shows the predicted class results so with this
Having an elegant syntax. It's much easier to read and model we have 296 positive attributes, 308 negative
write Python programs compared to other languages attributes 17 false positives and 13 false negatives.
like: C++, Java, C#. it makes programming fun and
allows you to focus on the solution rather than syntax. Table 3 actual and fake news
Furthermore, Python is also more forgiving of errors,
so you'll still be able to compile and run your program Model Predicted
until you hit the problematic part. Python is a flexible, class
simple coding programming language. This language
can support different styles of programming including Actual Yes TP FN
structural and object-oriented. Class No FP TN
IV. RESULTS
In order to interpret the result for the defined data set Table 3 represents actual and fake news in the form of
python programming tool was used. the results are prediction noted by True Positive (TP)
shown in the form of various tables and bar chart & false positive (FP)
I. Table 1 Dataset evaluation result

Results Values

Accuracy 95.26814

Precision 95.79288
Recall 94.56869

F-Measure 95.17685

Figure 1. Bar Chart


Table 1 shows the evaluation results applied on the
defined dataset. The accuracy of the model dataset is

International Journal of Scientific Research in Science and Technology ( www.ijsrst.com) | Volume 7 | Issue 3
426
Fakhra Akhtar et al Int J Sci Res Sci Technol. May-June-2020; 7 (3) : 423-428

Graphical representation of Real & Fake News Social Media Platforms by Evaluating Users'
Trustworthiness. arXiv preprint
DISCUSSION arXiv:1808.09922
Based on results it is observed that The accuracy of [2]. Brody, D. C., & Meier, D. M. (2018). How to
the model dataset is 95.26 % the precision results model fake news. arXiv preprint
95.79 % whereas recall and F-Measure shows 94.56% arXiv:1809.00964.
and 95.17% accuracy respectively. Whereas in [3]. Monti, F., Frasca, F., Eynard, D., Mannion, D.,
predicted models there are 296 positive attributes, 308 & Bronstein, M. M. (2019). Fake news detection
negative attributes 17 false positives and 13 false on social media using geometric deep learning.
negatives. In bar chart the results of the real and fake arXiv preprint arXiv:1902.06673.
news are shown. [4]. Vicario, M. D., Quattrociocchi, W., Scala, A., &
Zollo, F. (2019). Polarization and fake news:
V. CONCLUSION AND RECOMMENDATION
Early warning of potential misinformation
targets. ACM Transactions on the Web
The results show that The accuracy of the model
(TWEB), 13(2), 1-22.
dataset is 95.26 % the precision results 95.79 %
[5]. Tandoc Jr, E. C., Lim, Z. W., & Ling, R. (2018).
whereas recall and F-Measure shows 94.56% and
Defining “fake news” A typology of scholarly
95.17% accuracy respectively. Whereas in predicted
definitions. Digital journalism, 6(2), 137-153.
models there are 296 positive attributes, 308 negative
[6]. Volkova, S., Shaffer, K., Jang, J. Y., & Hodas, N.
attributes 17 false positives and 13 false negatives.
(2017, July). Separating facts from fiction:
This research recommends that authenticity of news
Linguistic models to classify suspicious and
should be analyzed first instead of drafting an opinion,
trusted news posts on twitter. In Proceedings of
sharing fake news or false information is considered
the 55th Annual Meeting of the Association for
unethical journalists and news consumers both should
Computational Linguistics (Volume 2: Short
act responsibly while sharing any news. The public
Papers) (pp. 647-653).
and the media are equally responsible for this
[7]. Apampa, O. (2019). Fake News: A Data-Driven
problem. People take advantage of the power they
Analysis Of The Role Of Influencers In The
hold, and small drops of misinformation turn into a
Spread Of Misinformation And Disinformation
huge sea of misunderstandings.
On Selected Social Media Platforms.
VI. ACKNOWLEDGMENT [8]. Rügenhagen, M., Beck, T. S., & Sartorius, E. J.
(2020). Information Integrity in the Era of Fake
I would like to thank Prof. Dr Imran Ahmad from the News.
department of Computer Science and Information [9]. TIOBE Software Index (2011). "TIOBE
Technology, RIPHA University Lahore, Pakistan. Programming Community Index Python". 1
[10]. "Programming Language Trends - O'Reilly
Radar". Radar.oreilly.com. 2 August 2006.
VII. REFERENCES [11]. Bakir, V., & McStay, A. (2018). Fake news and
the economy of emotions: Problems, causes,
[1]. Balmau, O., Guerraoui, R., Kermarrec, A. M., solutions. Digital journalism, 6(2), 154-175.
Maurer, A., Pavlovic, M., & Zwaenepoel, W. [12]. Gelfert, A. (2018). Fake news: A definition.
(2018). Limiting the Spread of Fake News on Informal Logic, 38(1), 84-117.

International Journal of Scientific Research in Science and Technology ( www.ijsrst.com) | Volume 7 | Issue 3
427
Fakhra Akhtar et al Int J Sci Res Sci Technol. May-June-2020; 7 (3) : 423-428

[13]. Shao, C., Ciampaglia, G. L., Varol, O., Flammini, Cite this article as :
A., & Menczer, F. (2017). The spread of fake
news by social bots. arXiv preprint Fakhra Akhtar, Faizan Ahmed Khan, Muhammad
arXiv:1707.07592, 96, 104. Tauseef Hanif, " Fake and Real News detection Using
[14]. Conroy, N. K., Rubin, V. L., & Chen, Y. (2015). Python", International Journal of Scientific Research
Automatic deception detection: Methods for in Science and Technology(IJSRST), Print ISSN :
finding fake news. Proceedings of the 2395-6011, Online ISSN : 2395-602X, Volume 7, Issue
Association for Information Science and 3, pp.423-428, May-June-2020. Available at
Technology, 52(1), 1-4. doi : https://doi.org/10.32628/IJSRST207376
[15]. Jang, S. M., & Kim, J. K. (2018). Third person Journal URL : http://ijsrst.com/IJSRST207376
effects of fake news: Fake news regulation and
media literacy interventions. Computers in
Human Behavior, 80, 295-302.
[16]. Wang, Y., Ma, F., Jin, Z., Yuan, Y., Xun, G., Jha,
K., ... & Gao, J. (2018, July). Eann: Event
adversarial neural networks for multi-modal
fake news detection. In Proceedings of the 24th
acm sigkdd international conference on
knowledge discovery & data mining (pp. 849-
857).
[17]. Waisbord, S. (2018). Truth is what happens to
news: On journalism, fake news, and post-truth.
Journalism studies, 19(13), 1866-1878.
[18]. Nielsen, R. K., & Graves, L. (2017). " News you
don't believe": Audience perspectives on fake
news.
[19]. Rubin, V. L., Conroy, N., Chen, Y., & Cornwell,
S. (2016, June). Fake news or truth? using
satirical cues to detect potentially misleading
news. In Proceedings of the second workshop
on computational approaches to deception
detection (pp. 7-17).
[20]. Rochlin, N. (2017). Fake news: belief in post-
truth. Library hi tech.
[21]. Kanchan Mahajan, Proff.J.S.Chitode, "Waste
Bin Monitoring

International Journal of Scientific Research in Science and Technology ( www.ijsrst.com) | Volume 7 | Issue 3
428
View publication stats

You might also like