{'fraction_non_alphanumeric': 0.022626834010959874, 'fraction_numerical': 0.009899239879794944, 'mean_word_length': 4.791197543500512, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Prediction Analysis Of Criminal Data Using Machine Learning

The human-being life necessities have encouraged the commission of crime since ancient times. Nowadays, many crimes factor and techniques have developed in a more sadistic way, causing more victims and loss. The authorized parties need to find a way to minimize the commission of a crime. This research aims to utilize linear regression algorithm for analyzing crime data to generate predictions for crime, which shows a quite reliable result. The result can be used by the authorized parties to help them prevent and handle upcoming crime.


Introduction
Crime is an act that can be potentially harmful to some individuals, a community, society, or the state that is forbidden and punishable by law [1], [2]. In Indonesia, crime record shows a rising trend in May 2019 [3]. Those quite high crime records not only harmful for the victims but also making citizens feel insecure.
Machine learning exists as technological development driven by the human need to analyze big data. The combination of big data and machine learning will drive incredible innovation across pretty much every industry [4]. As for maintaining security, they can be used to analyze crime data accurately to help prevent and minimize upcoming crime. Linear regression algorithm is one of the algorithms that can be used to make analytic predictions. This study uses the linear regression algorithm to predict crime.

Previous Work
The utilization of machine learning for predicting crime patterns should be supported by the right algorithm to generate more accurate crime prediction. Previous researcher has tried to use the K-Nearest Neighbor and boosted decision tree algorithm. Still, the percentage of prediction accuracy only ranged between 39% to 44%, which is quite poor to rely on [5]. Commonly used algorithms such as K-Nearest Neighbor, NaïveBayesian, decision trees, support vector machines aren't considered to generate accurate predictions [6]. The comparison of linear regression, additive regression, and decision stump to prove the level of effectiveness and accuracy for analyzing crime patterns shows that the linear regression algorithm gives the best result overall [7].

Data Source
The data used in this research are secondary, namely crime data from 2010 to 2019, located in Los Angles. The dataset used is data from the Los Angles Police Department (LAPD) [8], which has been collected since 2010 and is updated monthly. The dataset used has 2.036.897 rows and provide information about the type of occurred crime, area of the incident, time of the incident, the age and sex of the victim, as well as the weapons used by the perpetrators.

Preprocessing
The dataset needs to go through preprocessing to maintain data quality before further analysis is processed to produce more accurate predictions. In the preprocessing stage, the missing value will be filled, the data that contains noise will be changed, and data duplication will be deleted for the analysis process to run smoothly and generate better analysis. The preprocessing stage for each case can vary depending on the data [9]. In this study, the data obtained were quite consistent and had an appropriate format so that only cleansing was done to overcome the missing values and noises. Cleansing will be done using RapidMiner to resolve missing values and noises.

Prediction
Regression can be used to performs operations on a dataset where the target has numerical values and has been defined [10]. The data needed for regression are two-part, first section for defining model and the other for testing model [11]. The application of a linear regression algorithm to generate prediction will be made by Python.
In this study, the data will be divided into two, namely for training and testing. The training section will analyze and determine the model using 75% of the criminal record data, while the testing section to test the model will be done by the rest 25%. The model build will be tested by matching the prediction results between the prediction and original criminal record data. The linear regression algorithm is shown in the equation ( = ± ) with m as the level of the relation of variable x with the prediction of y, and c as the bias value. To find out the accuracy of the prediction results with the original data, it can be calculated with the equation (1) and (2):

Result
Before preprocessing is done, the data shows the presence of missing values and noises. Table 1 shows preview of data before preprocessing, and Table 2 shows the statistical data before preprocessing, which show missing values and some noises. The missing value and noise are filled in using the average value or by the mode value of each missing attribute, depends on the datatype. The average value is used to fill numeric value, while the mode is used for non-numeric value. Table 3 shows the data display after going through preprocessing and Table 4 shows the statistic data after preprocessing.

Table 4. Statistical Data After Preprocessing
The results of linear regression algorithm application for the crime data using Python are shown by using line chart. Figure 1

Conclusion
Linear regression algorithm can be used to predict criminal data with a value of R 2 = 0.19. These results indicate that the linear regression algorithm is good enough to be used for prediction. The implementation of linear regression for analytical predictions can be applied in the Indonesian region provided that it has a criminal database that is feasible to analyze because the attributes used in this study are attributes that also exist in Indonesia.