Using Global Terrorism Database (GTD) and Machine Learning Algorithms to Predict Terrorism and Threat

It is evident that there has been enormous growth in terrorist attacks in recent years. The idea of online terrorism has also been growing its roots in the internet world. These types of activities have been growing along with the growth in internet technology. These types of events include social media threats such as hate speeches and comments provoking terror on social media platforms such as twitter, Facebook, etc. These activities must be prevented before it makes an impact. In this paper, we will make various classifiers that will group and predict various terrorism activities using k-NN algorithm and random forest algorithm. The purpose of this project is to use Global Terrorism Database as a dataset to detect terrorism. We will be using GTD which stands for Global Terrorism Database which is a publicly available database which contains information on terrorist event far and wide from 1970 through 2017 to train a machine learning-based intelligent system to predict any future events that could bring threat to the society.


I. INTRODUCTION
There has been a huge growth in Internet users in the past decade. Technological advancement has not only benefited the society but also has given rise to various problems in the society. One of such threats is the growth in cyber terrorism. Due to exponential increase in Internet users it is evident that people have started using this technological advancement for carrying out unlawful activities. Purposeful use of computers, web and various other systems for hurting others or carrying out un-lawful activities or personal motive can be called as cyber terrorism. Like every coin has two sides, technological advancement has also its advantage and disadvantage. Nowadays we are exposed to much more vulnerability and risk on the web on the hands of predator or cyber-terrorists. Estonia, a Baltic nation which is continually developing as far as innovation, turned into a battleground for cyber terror in April, 2007 after debates with respect to the expulsion of a WWII soviet statue situated in Estonia's capital Tallinn.
It is very necessary to identify the fact that cyberterrorism has had very disastrous effect in our society. We intend to use various Machine Learning algorithms to analyze, predict and categorize various terrorist activities using various algorithms like Natural Language Processing (NLP), sentiment analysis, k-NN algorithm and random forest algorithm to train a system by feeding it with data from Global Terrorism Database and various threats related text on Social Media.

II. RELATED WORK
This paper intends to deal with the following details:a. To Study and investigate various techniques and work done used to identify and channel vicious and hurtful solitary substance online on the web. b. To play out a comprehensive investigation and contemplating of these systems and discover basic patterns. The underlying advance is to begin by thinking of a few meanings of withdrawn conduct, and after that quest up for some ideas on terrorist conduct. Studying asocial practice: Antisocial conduct, incorporates exercises, for example, "trolling, cyberbullying, grieving and criminal activities", they have generally been utilized and discussed. Research on Online people group to recognize introverted conduct has significantly led with subjective measures instead of quantitative.
These examinations for the most part included the various kinds of social defaming which happens and persuasive explanation for performing these types of exercises and various systems that are used by many people in light of these kinds of activities. Techniques to distinguish antisocial conduct: There are a few similar kinds of studies done on asocial practice. In any case many had been completed in this domain. Endeavors had been additionally done in the field of recognition along with avoidance of substantial indications identified with reserved messages in networks.

A. Antisocial Content Identification
The Fundamental goal is to discover untruthful, exploitative, bigot and fake substance on the online networks. Influencing the attitude of an individual or to coast misleading information to the network is the primary undertaking. Examining this information will result in the wellspring of abhor advertiser or reserved information.

B. Obtaining Criminal Information
Searching as well as investigating for criminal information and evidence can give concealed examples along with obscure patterns utilized by every lawbreaker. In spite of the fact that it is documented as well as investigated by concerned authorities that manages the wrongdoings and offenders to keep away from its abuse.

C. Cyber Infrastructure Shielding
It has the procedure to ensure digital foundation if there should be an occurrence of digital dangers and digital assaults. These assaults could be a foundational withdrawn action. It can also be an endeavor for risking the safety measures.
There can be numerous strategies as well as procedures for examining an individual"s brain however techniques haven"t been created for natural identification of asocial practices on the internet. Information as well as content available on interpersonal organization is either not structured or not classified information which turns into significant obstacle for locating reasonable technique for natural identification of anti-social practice.

III. DESIGN AND METHODOLOGY
Following approach were used for accomplishing the required target:

A. Data Set
The Global Terrorism Database, is an organization which is financed by (START) which stands for National Consortium for the Study of Terrorism and Responses to Terrorism, is a dataset of terrorist events ranging from a period length since 1970. The GTD holds more than 170 thousand assaults by terrorists having more than 40 factors for every occurrence, that made this dataset as "right now finest exhaustive unsorted information dependent upon psychological militant occasions on the planet. In perspective on its effectiveness and exhaustiveness, GTD information has highlighted in various scholastic papers as exact investigation for the examination on different parts of fear-based oppression, from current patterns to sorts of psychological oppression.

B. Data Preprocessing
The GTD incorporates in excess of 170,000 instances of terrorist events far and wide from 1970 to 2017. For every occurrence, data is accessible on the area and date of the comparing episode, summing up to 132 characteristics. Be that as it may, the information was gathered from various information assets, which would bring about information inconsistence. Regarding the present problem, we are setting the limit of offer proportion to twenty percent, that indicates those traits which have been documented inside over twenty percent of the all-out occurrences are investigated. Ensuing measurable investigation, more than 50 properties were chosen but left out information yet resides inside portion"s record. For taking care of the issue, the Mean Imputation (MI) technique is utilized, trading left out information using every single recognized estimation of the trait of the set in which the left-out quality has a place.

C. Classification
Appointing items to one of a few preset classes is the fundamental concept of classification. Two broadly utilized classifiers have been considered, k-Nearest Neighbor (k-NN) and Random Forest Algorithm. i.

K-Nearest Neighbour Classification Approach
k-NN falls under automatic learning algorithm category. K-NN algorithm is considered to be an instance-based algorithm. This algorithm is one of the notable methodologies in the field of example acknowledgment. The k-NN algorithm is normally and broadly utilized in categorizing text, and classifying text. k-NN algorithm is one of the widely used algorithm for mining purpose and is popularly used in classification of text and is effectively adaptable to enormous applications. Since k-NN algorithm can have multiple classifiers and class labels, it is preferred in multi-model classes.
The input data that is used as training data-sets of k-NN algorithm is plotted against multi-dimensional element, which is portioned into different areas which are then characterized based on the order of training data-sets. Fig.5 demonstrates a diagram of locale region of a k-NN classifier which includes three unique classifications, in particular w1, w2 and w3. These classifications are related with the preparation information and circles, triangles as well as square-blocks are marks of information point's w1, w2 and w3, separately. In the following figures, 'X' means the information preparing information for grouping.

Random Forest
Random Selection as well as bagging are the two machine learning methods that RF merges together to combine their benefits. In bagging forecast is made by selecting the maximum number of votes. This is done by training each and every tree, using bootstrap test. While Random-Feature selection looks for the best part in every node over irregular portion of the highlights. It is a renowned coordinated learning algorithm by taking decision tree as the fundamental classifier. It has demonstrated its accomplishment in applications like email spam filtering, voice classification, and picture classification and text classifier. To order another document from the information vector, it passes the information vector through every one of the trees of the forests with each tree giving a result, i.e. a classification, which is named as "votes" for that specific class. Like the election results, the last result would be the class that has the most votes. The most important features of Random Forest algorithms are enlisted below: a. Random Forest is un-affected by noise as well as outliers. b. Random Forest gives better result and is faster than boosting as well as bagging c. Incase of huge data sets RF is considered to be quite efficient. d. In comparison to other readily available classification algorithms, RF is considered more precise and hence superior. e. In case of missing data, Random Forest Algorithm is considered to be more productive for evaluating purpose.

IV. RESULTS
In this paper we have explored various classifiers on the basis of their accuracy and speed. We finally went with k-NN algorithm for Weapon Classifier and Random Forest algorithm for Perpetrator Classifier. k-NN algorithm was best suitable for Weapon Classifier and similarly Random Forest Algorithm stood out to be best for Perpetrator classifier on our multiple attempts using various algorithms. The data-sets generated using GTD was divided into the ratio of 8:2 for training and testing our model respectively.

A. Visualization
We have visualized various contents from the Global Terrorism Database, to better understand the Datasets we are provided with. We have visualized various attributes from the year 1996 to 2017 that were enlisted in the Global Terrorism Database. Following are the diagrams generated from the GTD after visualization of the contents based on attacks by year, fatalities by year, countries by total attack, and attacks by type. The diagrams below have been plotted using "catplot()".

Fig.6. Attacks by Year
The above bar diagram shows us the number of attacks carried out every year from the year 1996 to 2017. We can conclude that the attacks were increasing from the year 2011 to 2014 and then it started to gradually drop.

Fig.7. Fatalities by Year
The above bar diagram shows the number of fatalities that happened every year from 1996 to 2017.It is evident that the most fatalities happened between the years 2011 to 2017.

Fig.8. Top 20 Countries by Total Attack
The above diagram lists the countries based on the most number of terrorist acts acted upon. It is evident that Iran, Pakistan, Afghanistan and India are the top 4 countries where most number of attacks have happened from the year 1996-2017.

Fig.9. Total Attacks Type
The above bar diagram depicts the total attacks by type. It is evident that bombing and explosion followed by Armed Assault are the most preferred attack types with a total count of more than 90,000 attacks from the year 1996-2017. The World map in Fig.10 shows the hottest Terrorist locations, showing active terrorist encounters in South and East Asia.

B. Weapon Classifier
The weapon classifier was built using k-NN algorithm that classifies the attacks based on types of weapons. We have chosen "K" by trial and error strategy for which we obtained the ideal outcome. We have calculated the neighbors from the GTD where k=12.

Fig.11. k-NN Varying Number of Neighbors
The above graph was generated using k-NN algorithm by trial and error. The graph shows the accuracy for 12 different clustering and we finally got the most effective clustered dataset when k was equal to 12. Thus, from the majority of the 12 attributes we predicted the weapons that could be used. The accuracy that we got using the k-NN algorithm was 88.74%.

Fig.12. Total Attacks by Weapon Type
The above graph classifies the attacks by weapon types from the year 1996-2017. It is evident that explosion and firearms are the most preferred weapon types.

C.
Perpetrator Classifier The perpetrator classifier classifies various groups or organization that carries out illegal and influences terrorism. We used Random Forest Algorithm for creating the Perpetrator Classifier. We grouped and listed various groups responsible for various attacks from 1996 to 2017 using random forest algorithm. A list of major perpetrator groups was displayed, along with the accuracy, precision, recall and f1after the training of the model.

V. DISCUSSION AND CONCLUSION
Terrorism has become a huge threat over the world. Various Machine learning system, artificial intelligence and Data-Analytics have provided us with a system to help the investigator and anti-terrorist or counter-terrorist squad to rapidly decide the most probable perpetrator responsible of a particular terrorist attack. We have demonstrated how the methods like k-Nearest algorithm and Random Forest can help us predict the responsible perpetrator precisely eight out of ten times. This helps the anti-terrorist organizations to reduce the list of possible suspects and help them act rapidly to find and catch the real suspect. In future we further mean to attempt different algorithms and methods like deep learning models and package classifiers to further improvise the accuracy of result and hence successfully predict the perpetrator with more precision and accuracy. Besides this in future we also intend to use web-scrapping methods and sentimental analysis to study various posts and comments on social media sites for hatred speech and text and further filter them and create a classifier to merge the current project with the social media texts. Devyash Bordia is currently pursuing his Bachelors in Science and Technology degree in SRM Institute of Science and Technology. He is also a member of various technical clubs of SRM IST. He is currently working on a ML project on creating a classifier that studies Cancer.

AUTHORS PROFILE
Sanskar is currently pursuing his Bachelors in Science and Technology degree in SRM Institute of Science and Technology. He is also member of various technical clubs of SRMIST. He has participated in many national level technical events and fests. He is currently working on various web design and development projects.