1 Introduction
Crime is defined as any illicit conduct. Crime has an impact on people’s quality of life and the viability of societies, but more crucially, it can make people feel uneasy. The necessity to provide urban areas where residents feel safe and secure is explicitly stressed by pertinent policy and planning objectives like the UN Sustainable Development Goals, UN Habitat’s Safer Cities Program, OECD’s well-being index [1] or the EU’s Cohesion Reports [2]. In that regard, it has long been recognized that conventional crime-fighting tactics alone are insufficient [3]. Since the 1970s, but especially over the past two decades, policing paradigms have changed from reaction to prevention, from focusing just on the offender and contextual social elements to also taking into account urban issues related to space, time, and the creation of opportunity [1]. So, there are three fundamental concepts on which the principles of environmental criminology [4, 5] are built. First, it should be noted that criminal behavior is greatly influenced by the context of the location in which it occurs, i.e., place matters [1], because it has unique qualities that either amplify or lessen crime. As a result of these territorial conditions, which fluctuate in both space and time, crime patterns are not distributed randomly. Thirdly, a sizable decrease in insecurity can be attained by altering the characteristics as well as by directing resources (of police, of urban planning, or of social or cultural intervention) to these hotspot places. There are a variety of strategies for preventing crime that center on interventions, organized activities, and procedures that address environmental, social, economic, and criminal justice system aspects. The common goal of all methods is to lessen the likelihood that crime will occur in public places [6]. These characteristics may include a variety of racial and ethnic groups, including white Americans, African Americans, and Asians, as well as different income levels (low, middle, and high), age groups, and family structures, including single parents, married couples, unmarried couples, and parents with children. They may also include the population of the town or locality where people live, as well as housing costs, house types, and home sizes, as well as the number of civil law enforcement officers assigned to the area [7]. The results of the crime prediction system may be influenced by a variety of factors due to the vast number of attributes present in the communities and crime data. To increase the precision of prediction systems, it is essential to choose the most pertinent features and data. The performance of the learning algorithm is frequently motivated by the feature selection (FS) technique, which identifies relevant features and eliminates irrelevant ones. FS can also decrease data, storage, and expense while learning more about the process [8].
In this proposed approach, five different regression models which include regression models such decision tree regressor, Multi-Layer Perceptron Model (MLP) regressor, support vector regression (SVR), random forest regressor, and K-Neighbors regressor to build five model have been implemented to predict communities and crime. Also, the proposed have been evaluated using statistical metrics such as Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Mean Square Error (MSE), Root Mean Square Error (RMSE), and R2. Results show the achievement of better performance with decreased error rate when compared to traditional prediction models. The rest of the paper is organized as follows. In Section 2, we present the literature review. In Section 3, Methodology is presented. In Section 4 includes the experimental setup. Finally, Section 5 includes the conclusion and suggestions.
2 Literature Review
For many years, various studies have been done to communities and crime data. The study in [9] sought to characterize the key characteristics of the particular crimes and divide them into three groups. Another study created a method for predicting where crimes will occur by using the frequent closed item set lattice (FCIL) algorithm and socioeconomic probability calculations to pinpoint crime scenes using UCI data.
Working in Taiwan, Lin et al. [10] suggested a data-driven approach based on the broken windows theory to anticipate rising crime hotspots. Model performance was enhanced by accumulating data with various time scales. Deep learning algorithms, random forests, and naive Bayes offered the most accurate predictions of all examined techniques. However, Zhang et al. [11] found that the deep learning long short-term memory (LSTM) model outperformed others when employing built environment sites of interest and urban road network density as covariates to increase performance. Matijosaitiene et al. [12] found that linear models worked better in another recent investigation on the space-time patterns of theft in Manhattan, where an application prototype for locating safer parking was established. Pinto et al. [13] compared five boroughs of New York City and found that while decision trees were the most accurate at identifying the type of crime portrayed, multivariate linear regression produced a superior accuracy at predicting the borough where the crime happened.
In [14], authors suggested area-specific predictive models employing sparse data and conducted a comparative examination of the Kernel Density Estimation (KDE) and Risk Terrain Modeling (RTM) methods for producing hotspot maps. For the purpose of predicting crime hotspots, [15] adopted a spatial-temporal model based on histogram-based statistical techniques, Linear Discriminant Analysis (LDA), and KNN. In order to train an Artificial Neural Network (ANN) augmented by the Gamma test to forecast the crime hotspots in Bangladesh, a crime incidence-scanning technique was used in [16]. In order to examine drug-related crime data in Taiwan and forecast new hotspots, [10] employed a data-driven machine-learning system based on broken-window theory, spatial analysis, and visualization approaches. In [17], authors used Open Street Map (OSM) and geospatial data for several categories of crime in the province of Nova Scotia (NS), Canada, to develop a machine-learning model for crime prediction. They also employed reversegeocoding approach and a density-based clustering algorithm. For the purpose of forecasting crimes in the City of Chicago, authors in [18] proposed a feature-level data-fusion method based on a Deep Neural Network (DNN) trained by spatial, temporal, environmental, and joint-feature representation layers. Using cross-domain urban datasets, meteorological data, points of interest, human mobility data, and complaint data, a transfer-learning framework that captures temporal-spatial patterns was developed in [19]. A fully probabilistic method built on the Bayesian approach was used in [20] to simulate the relationship between crime statistics and outside variables like demographics and geographic location in the Australian state of New South Wales (NSW). An overview of criminal data mining using ANN, decision trees, rule induction, the nearest-neighbor method, and evolutionary algorithms was published in [21]. A trustworthy predictive model for predicting crime patterns in metropolitan regions was developed in [22] using a methodology based on the Auto-Regressive Integrated Moving Average model (ARIMA). The work in [23] used the random forest method to measure how important urban factors are for predicting crime in Brazil. The study in [24] describes the development of a crime prediction solution for Chilean large cities using the prospective technique, Dempster-Shafer theory of evidence, and multi-kernel method. Three algorithms were created, put to the test, and compared in [25] for forecasting crimes in the city of San Francisco: KNN, Parzen windows, and Neural Networks.
3 Methodology
In this work, the regression model are used to predict the air quality. We five regression models including decision tree regressor, MLP regressor, SVR, random forest regressor, and K-Neighbors regressor. Figure 1 represents the overview of regression model for predicting the air quality. It comprises three levels: a) the first level includes data pre-prospecting and feature extraction; b) the second level he second layer contains five different regression models which are used to predict the air quality along with its working principle; c) the last level consists of certain steps like training and testing models and evaluation, and then the final step for prediction.
3.1 Data Pre-processing and Feature extraction
The data were preprocessed to remove the missing and unwanted data to obtain a cleaned datasets. Then, the features are extracted from the cleaned data to obtain the best features for training models.
3.2 The proposed models
We proposed decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor to build fve model. We give a brief overview for these method as follows.
Decision Trees. Decision trees employ a tree-like model of decisions and their results to categories or predict data. The use of a decision tree is advantageous for both prediction and a classification tree (regression tree). A single regression tree may not be able to predict complicated circumstances due to its lower reliability when compared to a random forest regression (RFR). As an ensemble of regression trees, RFR is the most popular decision tree-based model [26, 27, 28].
Multi-Layer Perceptron Model. Due to its ability to construct extremely complicated nonlinear models, the Multilayer Perceptron (MLP) is a feed forward neural network type that is utilized for air pollution prediction. The network gets the relevant input parameters, which triggers the MLP. The input signals created by these input parameters are sent from the input layer to the hidden layer, then from the hidden layer to the output layer, throughout the network. The scaled input vector that the input layer’s neurons introduce is multiplied by the weights, which are an actual numerical value [29, 30, 31].
Support Vector Regression. Support vector regression is one application of the 1954-invented support vector machines (SVM) (SVR). Structural minimization and statistical learning theory are the cornerstones of SVM. The main objective of the kernel function is to change the data from a nonlinear to a linear feature space by moving it from a low-dimensional to a high-dimensional space. The typical kernel functions that can be used in SVR include radial basis functions, linear basis functions, and polynomial basis functions [32, 33, 34].
Random Forest. Both classification and regression issues can be solved using the random forest (RF) machine learning technique, which is based on ensemble learning. It belongs to the class of supervised machine learning algorithms. The basic approach used in random forests, bagging, is used to build a set of trees in simultaneously in order to produce the random forest design. Although the trees of the random forest are formed, they do not interact. The training step of this method entails the construction of a large number of decision trees that may be used for either classification or regression. The average forecast given by each tree is the outcome of random forest in regression issues. Because of this, the forecast made using random forest is seen as a mixture of the several predictions made using built-in decision trees [35, 36].
k Nearest Neighbors. The k Nearest Neighbors (kNN) algorithm is one of the most widely used machine learning techniques. It has uses for categorization. Machine learning makes inferences from the data at hand using statistical and mathematical methods. kNN is a non-parametric learning algorithm. The k nearest neighbors method saves all of the current instances and organizes new cases based on distance function requirements. Instead of being learned, the information utilized for training is memorized. A k value is determined as a result of the algorithm’s execution. There are k components to take into account. When a value is attained, the distance to the nearest k element is calculated. If k is 1, the instance is simply assigned to its nearest neighbor. For the bulk of data sets, the optimal k numbers traditionally varied from 3 to 10. The Euclidean function is frequently used to calculate distances. The Manhattan, Minkowski, and Hamming functions are alternatives to the Euclidean function [37].
The Proposed Ensemble Model. After optimizing the parameters of each regression model in the proposed ensemble, these optimized models are integrated into a unified ensemble. This ensemble consists of five regression models including Decision Tree Regressor, MLP Regressor, SVR, Random Forest Regressor, and KNeighbors Regressor. The output of the ensemble model is the optimal predicted value that best matches the input features of the air quality.
3.3 Regression Model Training
After feature extraction step, the features represent the data training for models. Five separate models were subsequently created for testing and training. In order to deploy the models, you must frst confrm the prediction value range. If necessary, you should then forecast if the air quality levels are satisfactory or good; if not, the models and datasets need to be improved once more.
3.4 Evaluation
The most popular evaluation criteria are the correlation coefficient (R2), Mean Absolute Error (MAE), Root Mean Square Error (RMSE) and Relative Absolute Error (RAE). The R2 value shows the fitting degree of regression, MAE represents the difference between predicted and actual values, RMSE focuses on the impact of extreme values based on MAE, while RAE calculates the variance of a model when comparing the performance of different models. As MAE and RMSE depend on the scale of the data that’s why RAE can be extremely helpful when comparing different data with different scales. The R2, MAE, RMSE and RAE are calculated by using Eqs. 1 to 3, respectively.

4 Experimental Results
4.1 Dataset
Communities within the United States. The data combines socio-economic data from the 1990 US Census, law enforcement data from the 1990 US LEMAS survey, and crime data from the 1995 FBI UCR. To evaluate algorithms that choose or figure out weights for qualities, a lot of variables are included. Aspects were chosen if there was any conceivable connection to crime (N=122) and the trait to be predicted; however, obviously unrelated attributes were excluded (Per Capita Violent Crimes). The dataset contains characteristics that relate to the neighborhood, law enforcement, and the percentage of officers assigned to drug enforcement units. Examples of these variables relate to the percentage of the population that is considered urban and the median family income. The population and the total number of crime variables judged to constitute violent crimes in the United Statesmurder, rape, robbery, and assault—were used to generate the per capita violent crimes variable. Regarding the counting of rapes, there was reportedly considerable debate in some areas. These led to missing rape data, which led to inaccurate per-capita violent crime data. The dataset excludes these cities. Many of these missed communities were in the Midwest of the United States. Based on the original values, the data are described below. An unsupervised, equal-interval binning technique was used to standardize all numerical data into the decimal range of 0.00–1.00. The distribution and skew of attributes are maintained (hence for example the population attribute has a mean value of 0.06 because most communities are small). E.g. The normalized (0-1) form of a value with the description ‖mean individuals per home‖ is actually the attribute’s real value.
4.2 Results and discussion
We evaluate the proposed models based on the communities and crime dataset. The metrics, that are presented in subsection 3.4, are used to evaluated the proposed model. The results of the proposed model been shown in Table 1.
Decision Tree 0.067 0.051 0.0061 0.96 0.92 17.63 0.918 0.8762 Multi-layer Perceptron 0.048 0.0368 0.0027 0.979 0.959 12.572 0.9585 0.9114 support vector regression 0.0446 0.03476 0.0056 0.9820 0.9645 11.755 0.9637 0.9164 Random forest 0.1026 0.0810 0.0124 0.9022 0.8139 27.0301 0.8082 0.8052 K-nearest neighbors 0.0195 0.0137 -0.0019 0.9966 0.9933 5.1350 0.9931 0.9670
As shown in Table 1, we note that the experimental results enhance the results. It is further observed all the five models produce good results. In terms of RMSE for the proposed models, the results that are obtained 0.067, 0.048, 0.0446, 0.1026, and 0.0195 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the KNeighbors regressor model achieved the best results. In terms of MAE for the proposed models, the results that are obtained 0.051, 0.0368, 0.03476, 0.0810, and 0.0137 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the KNeighbors regressor model achieved the best results. In terms of MBE for the proposed models, the results that are obtained 0.0061, 0.0027, 0.0056, 0.0124, and -0.0019 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the K-nearest neighbors model achieved the best results. In terms of R for the proposed models, the results that are obtained 0.96, 0.979, 0.9820, 0.9022, and 0.9966 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the K-nearest neighbors model achieved the best results. In terms of R2 for the proposed models, the results that are obtained 0.92, 0.959, 0.9645, 0.8139, and 0.9933 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the K-nearest neighbors model achieved the best results. In terms of RRMSE for the proposed models, the results that are obtained 17.63, 12.572, 11.755, 27.0301, and 5.1350 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the K-nearest neighbors model achieved the best results. In terms of NSE for the proposed models, the results that are obtained 0.918, 0.9585, 0.9637, 0.8082, and 0.9931 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the Random forest model achieved the best results. In terms of WI for the proposed models, the results that are obtained 0.8762, 0.9114, 0.9164, 0.8052, and 0.9670 for decision tree regressor, MLP regressor, SVR, random forest regressor, and KNeighbors regressor, respectively. We observe that the Random forest model achieved the best results. Two experiments of ensembles are conducted in this work including average ensemble and ensemble using K-Neighbors Regressor. These models are evaluated based the RMSE, MAE, MBE, R, R2, RRMSE, NSE, and WI metrics as shown in Table 2.
The average ensemble yielded the results of RMSE, MAE, MBE, R, R2, RRMSE, NSE, and WI by 0.0435, 0.0328, 0.0050, 0.9842, 0.9686, 5.1350, 0.9660, and 0.9212, respectively. While ensemble using K-Neighbors regressor achieved the results of RMSE, MAE, MBE, R, R2, RRMSE, NSE, and WI by 0.0091, 0.0085, -0.0007, 0.9987, 0.9973, 3.1898, 0.9973, and 0.9795.
5 Conclusions
In this paper, we proposed the regression models to predict the communities and crime including decision tree regressor, MLP regressor, SVR, random forest regressor, and K-Neighbors regressor. The average ensemble and ensemble using K-Neighbors Regressor are used for evaluation the proposed models. We used MSE, MAE, MBE, R, R2, RRMSE, NSE, and WI metrics to evaluate the proposed regression models and ensemble models. The K-Neighbors regressor model achieved the best results for RMSE, MAE, R, R2, RRMSE, and MBE. While the random forest regressor model achieved the best results for NSE and WI.