# The Social Public Issues Analysis Model Based on Deep Learning

Authors: Yanqiong Gu; Jianyong Shi
Journal: Scientific Programming
 (2022)

---

## Abstract

To improve the governance effect of public communities and protect community security, combined with the basic principles and network structure of CNN network in deep learning, a community security risk prediction model based on improved single-channel CNN network and decision tree is constructed. The experimental results show that expanding the single channel to the multichannel network greatly extends the receptive field of CNN network. Simultaneously, the accuracy of the prediction model is improved, which is as high as 87.7%. After inputting the output values of every single model into the comprehensive model, the prediction accuracy of the comprehensive model is improved by 4.8%. The feasibility and effectiveness of this method are further demonstrated.


---

## Body

## 1. Introduction

In recent years, with the rapid development of deep learning, the probability prediction of crime occurring in the field of public community has become the focus of the current research in the field of community safety protection. The role of community crime prediction is to help the police patrol, prevent crime ahead of time, and ensure people’s safety of life and property. At present, some cities have designed and developed a police prediction system. However, the system still has the problem of low accuracy of risk prediction and cannot effectively protect community security. Among them, the wide application and popularization of deep learning make this artificial intelligence technology in image classification, speech recognition, and motion capture and other fields have achieved good application results. Based on this, combined with the learning characteristics and feature extraction ability of deep learning, it is applied to public community safety management and risk prediction.For risk prediction, many scholars and experts have carried out a lot of exploration and analysis. For example, Savadkoohi and others applied neural network to motion prediction. And the corresponding neural network prediction model is constructed. Moreover, the model was compared with recursive neural network (RNN), short and long-time memory (LSTM), and one-dimensional convolutional neural network (1D-CNN). The comparison results show that the constructed neural network model can accurately predict human motion state through time-series signals (based on FES measurement) and has certain effectiveness [1]. Shuang and Tiantian applied the prediction model to power electronic equipment. Thus, an early warning model based on FPGA and neural network with radiation function is built to accurately predict and analyze the currency risks from 2010 to 2015. The results show that combining radiation with the neural tissue model makes the error between the prediction effect and the actual effect less than 11%, which has certain predictability [2]. Rui proposed to build a risk prediction model in the field of financial risk. The neural network in deep learning is used for feature extraction and learning of financial text information, so as to realize effective risk prediction in the financial market [3]. Tu et al. applied the deep learning method to the risk prediction of lung cancer to improve the diagnostic accuracy of lung cancer [4]. Fangneng et al. applied the genetic algorithm to risk assessment, providing a reference for the application of machine learning in risk prediction [5]. Soft computing and others applied the deep learning model to the prediction of social security risk in the United States, thus opening up the application of deep learning in security risk management [6–9]. Based on this, a community security risk prediction model based on deep learning is proposed. And the feasibility of the model is verified experimentally, which provides reference data for risk prediction in the same field.


## 2. Basic Methods

### 2.1. Convolutional Neural Network Algorithm

The concept of convolutional neural network was proposed by emulating the biological vision system. Enlightened by the receptive field mechanism, and citing relevant theories in neurocognitive, the Fukushima’s team created the first convolutional neural network framework. It is a classical artificial neural network framework, which has advantages in processing data like network, such as image and video data. Convolutional neural network uses convolutional mathematics, namely, a mathematical operation of two real variable functions, as shown in the following formula [10–12]:(1)st=x∗wt.There are input layer, convolution layer, pooling layer, full connection layer, and output layer in the convolutional neural network. The architecture is shown in Figure1.Figure 1
The architecture of convolutional neural network.The input layer enters data into the convolutional neural network, and the data contains different feature information.Convolution layers use multiple feature faces to extract feature information of input data. For example, the deep convolution layers are used to extract the advanced features, while the shallow convolution layers are used to extract the low-level features. The convolution kernel is similar to the feature extractor. Where each convolution kernel is responsible for extracting the feature information of local areas. For example, the convolution core for two-dimensional data is a weight matrix of 5 × 5 or 3 × 3. The length and width of the convolution kernel are limited. And multiplying the length by the width of the convolution layer can determine the size, while the depth of the convolution kernel is consistent with the depth of the current image. Therefore, when specifying the convolution kernel, only two parameters, length and width, are required to be set.The pooling layer mainly has two functions. One is to use multiple feature maps to extract feature information. At the same time, it tries to reduce the low-latitude operation under the premise of fully retaining the features. The second is to reduce the number of full connections between convolution layers, thereby reducing the computational volume. There are a variety of pooling methods created to better extract global or local features, which are maximum pooling, spectrum pooling, mixed pooling, mean pooling, spatial pyramid pooling, and so on [13]. If a classifier is laid after the pooling layer, the overfitting may be induced due to the high input dimension of the classifier, which can be solved by deploying the convergence layer after the convolution layer.The full connection layer maintains full connection with all neurons in the previous layer, which performs global integration and clustering of feature information in the input layer or convolution layer. The full connection of the convolutional neural network is shown in Figure2 [14–17].Figure 2
The full connection of convolutional neural network.For the output layer, it can be seen that the output is determined by the function of convolutional neural network. If the function is supervised learning, the output layer acts as a classifier, just like SoftMax, SVM, and so on. If the function is unsupervised learning, the output of output layer is feature reconstruction.Convolutional neural network has local connectivity and weight sharing, and some panning, scaling, and rotation can remain unchanged. From the application effect, the convolutional neural network has the advantages of sparse interaction, parameter sharing, and so on.


### 2.2. CART Decision Tree

CART decision tree algorithm is a binary tree, which is a classification and regression tree algorithm. It can be used for both classification and regression. Whether it applies to regression tree or decision tree is determined by the target task. If the results to be predicted are discrete data, the CART can generate the classification decision tree. If the result to be predicted is continuous data, the CART can generate the regression decision tree. When the CART is a classification tree, the GINI value is used as the basis of node splitting. When the CART is a regression tree, the MSE (mean square error) is used as the basis of node splitting. Since this paper mainly predicts the number of community issues, which is a continuous value, the CART regression tree algorithm is selected.CART regression tree adopts mean square error to carry out model measurement. Then, feature screening is achieved by establishing regression equation and pruning, and the specific calculation formula is as follows [18]:(2)MSED=1M∑1Mym−y^m2,minj,smin∑x1∈R2j,sy1−c22c1,CaTt=CTt+aTt,CaT=CT+a,a=CT−CTtTt−1.


## 2.1. Convolutional Neural Network Algorithm

The concept of convolutional neural network was proposed by emulating the biological vision system. Enlightened by the receptive field mechanism, and citing relevant theories in neurocognitive, the Fukushima’s team created the first convolutional neural network framework. It is a classical artificial neural network framework, which has advantages in processing data like network, such as image and video data. Convolutional neural network uses convolutional mathematics, namely, a mathematical operation of two real variable functions, as shown in the following formula [10–12]:(1)st=x∗wt.There are input layer, convolution layer, pooling layer, full connection layer, and output layer in the convolutional neural network. The architecture is shown in Figure1.Figure 1
The architecture of convolutional neural network.The input layer enters data into the convolutional neural network, and the data contains different feature information.Convolution layers use multiple feature faces to extract feature information of input data. For example, the deep convolution layers are used to extract the advanced features, while the shallow convolution layers are used to extract the low-level features. The convolution kernel is similar to the feature extractor. Where each convolution kernel is responsible for extracting the feature information of local areas. For example, the convolution core for two-dimensional data is a weight matrix of 5 × 5 or 3 × 3. The length and width of the convolution kernel are limited. And multiplying the length by the width of the convolution layer can determine the size, while the depth of the convolution kernel is consistent with the depth of the current image. Therefore, when specifying the convolution kernel, only two parameters, length and width, are required to be set.The pooling layer mainly has two functions. One is to use multiple feature maps to extract feature information. At the same time, it tries to reduce the low-latitude operation under the premise of fully retaining the features. The second is to reduce the number of full connections between convolution layers, thereby reducing the computational volume. There are a variety of pooling methods created to better extract global or local features, which are maximum pooling, spectrum pooling, mixed pooling, mean pooling, spatial pyramid pooling, and so on [13]. If a classifier is laid after the pooling layer, the overfitting may be induced due to the high input dimension of the classifier, which can be solved by deploying the convergence layer after the convolution layer.The full connection layer maintains full connection with all neurons in the previous layer, which performs global integration and clustering of feature information in the input layer or convolution layer. The full connection of the convolutional neural network is shown in Figure2 [14–17].Figure 2
The full connection of convolutional neural network.For the output layer, it can be seen that the output is determined by the function of convolutional neural network. If the function is supervised learning, the output layer acts as a classifier, just like SoftMax, SVM, and so on. If the function is unsupervised learning, the output of output layer is feature reconstruction.Convolutional neural network has local connectivity and weight sharing, and some panning, scaling, and rotation can remain unchanged. From the application effect, the convolutional neural network has the advantages of sparse interaction, parameter sharing, and so on.


## 2.2. CART Decision Tree

CART decision tree algorithm is a binary tree, which is a classification and regression tree algorithm. It can be used for both classification and regression. Whether it applies to regression tree or decision tree is determined by the target task. If the results to be predicted are discrete data, the CART can generate the classification decision tree. If the result to be predicted is continuous data, the CART can generate the regression decision tree. When the CART is a classification tree, the GINI value is used as the basis of node splitting. When the CART is a regression tree, the MSE (mean square error) is used as the basis of node splitting. Since this paper mainly predicts the number of community issues, which is a continuous value, the CART regression tree algorithm is selected.CART regression tree adopts mean square error to carry out model measurement. Then, feature screening is achieved by establishing regression equation and pruning, and the specific calculation formula is as follows [18]:(2)MSED=1M∑1Mym−y^m2,minj,smin∑x1∈R2j,sy1−c22c1,CaTt=CTt+aTt,CaT=CT+a,a=CT−CTtTt−1.


## 3. Construction of Community Security Prediction Model

This paper adopts the number of community security cases as the basic feature attribute. And the other characteristic attributes, which is closely related to it, are also selected. On this basis, the prediction model of community security is constructed.


### 3.1. Construction Ideas of Comprehensive Prediction Model

Using feature filter to sift out the relevant data to select the key feature factors and divide them into training sets and test sets. The community security prediction model is constructed. In order to meet the prediction requirements, this paper integrates the CART regression tree model to construct a comprehensive prediction model under the framework of convolutional neural network model. It can accurately predict the number of community security cases. The construction process of community security prediction model is shown in Figure3.Step 1. Read the data. The selected key feature factors are included in the Python, including the number of community security cases, H-City climate data, community second-hand housing prices, holiday data, and so on.Step 2. Classify the relevant data. The 80% of the data are included in the training set, and the 20% of the data are included in the test set.Step 3. Build an intelligent prediction model. The multichannel convolution neural network prediction model and CART regression tree prediction model are established to predict the number of community security cases, respectively.Step 4. Use the training set data to train the convolutional neural network model and the CART regression tree prediction model. And at the same time, carry out hyperparameter mediation to determine the optimal output of each model.Step 5. Improve the applicability of the comprehensive prediction model. The comprehensive prediction model is constructed based on the framework of neural network. Use the test set to verify the comprehensive prediction model and optimize the evaluation index of the model.Step 6. Evaluate the risk. Use the comprehensive prediction model to predict the number of community security cases in the future and evaluate the risk of community security.Figure 3
Flowchart of community security risk model construction.


### 3.2. Data Source Acquisition and Feature Selection

The community security data of community Z in H city from 2017 to 2019 are collected through official channels to evaluate the community risk value. When collecting community security data, it is inevitable to encounter the absence of a dataset. And the appropriate measures should be taken according to the importance of missing values and the difficulty of obtaining them. Specifically, if the missing values are not significant to the objectivity of the data information and the validity of the results, the missing values can be deleted. If the amount of missing value data is small and easy to obtain, manual filling can be adopted. If the missing value has a great impact on the research work, moving window mean value can be used to fill, and the formula is as follows [19–22]:(3)Xm=16Xm−3+Xm−2+Xm−1+Xm+1+Xm+2+Xm+3.There are differences for the obtained data in the unit magnitude. And the analysis results of the community security characteristics are affected. Therefore, it is necessary to normalize the collected data. And map them all to the interval [0,1], so as to eliminate the influence of unit magnitude on the analysis results. The formula for data normalization is as follows:(4)y=x−MinMax−Min.When constructing the community security case prediction model, the feature attribute data in the attribute table of the basic dataset should be selected first. The characteristic factors most closely related to the number of community security cases can be selected. In general, the selected characteristic factors are more correlated with the number of community security cases. Therefore, the improved Pearson correlation coefficient is used for correlation analysis in this paper, and the formula is as follows [23]:(5)R=∑1nXi−XYi−Y∑1nYi−Y¯2∑1nXi−X¯2.After the analysis, this paper finally selects the number of public security cases, holiday data, climate score, and community second-hand housing prices as the input characteristic attribute of the prediction model to build the number of community security cases.


### 3.3. Case Prediction Model Based on Convolutional Neural Network

#### 3.3.1. Construction of Convolutional Neural Network Model

To predict the number of community security cases, first of all, it is necessary to identify the various factors associated with the risk of community policing. Then, the characteristics of data source are analyzed. Finally, the characteristic attributes that have the greatest impact on community security risk are selected, including the number of community daily security cases, climate data of H City, community second-hand housing prices, and holiday data.The prediction accuracy of community security cases depends on whether the extraction of characteristic attributes is reasonable. The traditional convolutional neural network can only extract local feature, so it is necessary to improve it. This paper proposes an autoregressive multichannel convolutional neural network model. There are input layer, convolution layer, maximum pooling layer, flatten layer, dropout layer, and full connection layer in the model. At the same time, the DenseNet is deployed behind the full connection layer to achieve the connection of different layers and the connection of each feature maps [24–26]. It can be seen that the gradient disappearance problem can be effectively suppressed.Using the convolution neural network for prediction, the input attribute features will directly affect the predictions. Therefore, improving the traditional neural network model from the input layer, the multichannel convolutional neural network prediction model can be obtained. And there are outstanding advantages for the improved model, the wider receptive field, and the higher prediction accuracy.The structure of traditional convolutional neural network model and multichannel convolutional neural network model is shown in Figure4.Figure 4
The structure of convolutional neural network.The first step is to compile dataset. The input data needs to be transformed into a 7 × 4 matrix. Where the seven rows, respectively, represent the data of each day in the previous seven days, and the four columns, respectively, represent the extracted four feature datasets. The data input to the model can be expressed as1,4, and 7. Here, “1” represents a sample, “7” represents the continuous data of the previous seven days, and “4” represents the variable dimension.The second step is to establish the deep convolutional neural network. First, using the one-dimensional convolution kernel to extract the feature of variable vectorVi=D1,D2,D3,D4,D5,D6,D7 in input layer Li. Then, build a one-dimensional convolution nuclear feature extractor, and there are 32 convolution kernels of size equal to 3. What is more, the activation function is ReLU function.The convolution layer is connected to a convolution kernel with a one-dimensional size equal to 3 and then connected to a maximum pooling layer with a one-dimensional size equal to 2. After that the flatten is performed on the extracted features to obtain the flattening layerFi.There are two full-connect layers D1 and D2 connected after the flattening level. Both use the ReLU function. And there are 200 and 100 neurons, respectively, within the hierarchy. After the full-connection layer D2, an output layer is connected, which contains only one neuron, corresponding to the data values of the prediction day.The third step is to train and verify the model. After the deep convolutional neural network is established, it is also necessary to train it with the training set. The closer the model value is to the observation value, the smaller the mean square error (MSE) is. After the model training is completed, the test set is predicted by the model to verify the model prediction accuracy. The ReLU function is used as the activation function, which can effectively avoid the problem of gradient disappearance in the process of model training.After establishing the autoregressive multichannel convolutional neural network model and the completing the model training and verification, the N-dimensional vector of the next day (i.e., the eighth day) is predicted by using the community feature vector of the previous seven days. And the new feature vector is finally output by window sliding.Considering that both the input and output data of the model are multiples of 7, it is necessary to perform data cutting. The initial and predicted datasets are represented as follows:(6)A11A12A13A14A15A16A17,A21A22A23A24A25A26A27,.......An1An2An3An4An5An6An7,⟶A18,A28,.......Aa8,,A12A13A14A15A16A17A18,A22A23A24A25A26A27A28,.......An2An3An4An5An6An7An8,⟶A19,A29,.......Aa9,,where A11A12A13A14A15A16A17 represents a feature of the first seven days, n rows represent n features of a week, and the feature vector of the predicted eighth day is on the right. After the prediction results of day eight are obtained, the feature vectors of day nine can be predicted by window sliding, as shown in formula (6). Therefore, long-term prediction can be performed by window sliding.


## 3.1. Construction Ideas of Comprehensive Prediction Model

Using feature filter to sift out the relevant data to select the key feature factors and divide them into training sets and test sets. The community security prediction model is constructed. In order to meet the prediction requirements, this paper integrates the CART regression tree model to construct a comprehensive prediction model under the framework of convolutional neural network model. It can accurately predict the number of community security cases. The construction process of community security prediction model is shown in Figure3.Step 1. Read the data. The selected key feature factors are included in the Python, including the number of community security cases, H-City climate data, community second-hand housing prices, holiday data, and so on.Step 2. Classify the relevant data. The 80% of the data are included in the training set, and the 20% of the data are included in the test set.Step 3. Build an intelligent prediction model. The multichannel convolution neural network prediction model and CART regression tree prediction model are established to predict the number of community security cases, respectively.Step 4. Use the training set data to train the convolutional neural network model and the CART regression tree prediction model. And at the same time, carry out hyperparameter mediation to determine the optimal output of each model.Step 5. Improve the applicability of the comprehensive prediction model. The comprehensive prediction model is constructed based on the framework of neural network. Use the test set to verify the comprehensive prediction model and optimize the evaluation index of the model.Step 6. Evaluate the risk. Use the comprehensive prediction model to predict the number of community security cases in the future and evaluate the risk of community security.Figure 3
Flowchart of community security risk model construction.


## 3.2. Data Source Acquisition and Feature Selection

The community security data of community Z in H city from 2017 to 2019 are collected through official channels to evaluate the community risk value. When collecting community security data, it is inevitable to encounter the absence of a dataset. And the appropriate measures should be taken according to the importance of missing values and the difficulty of obtaining them. Specifically, if the missing values are not significant to the objectivity of the data information and the validity of the results, the missing values can be deleted. If the amount of missing value data is small and easy to obtain, manual filling can be adopted. If the missing value has a great impact on the research work, moving window mean value can be used to fill, and the formula is as follows [19–22]:(3)Xm=16Xm−3+Xm−2+Xm−1+Xm+1+Xm+2+Xm+3.There are differences for the obtained data in the unit magnitude. And the analysis results of the community security characteristics are affected. Therefore, it is necessary to normalize the collected data. And map them all to the interval [0,1], so as to eliminate the influence of unit magnitude on the analysis results. The formula for data normalization is as follows:(4)y=x−MinMax−Min.When constructing the community security case prediction model, the feature attribute data in the attribute table of the basic dataset should be selected first. The characteristic factors most closely related to the number of community security cases can be selected. In general, the selected characteristic factors are more correlated with the number of community security cases. Therefore, the improved Pearson correlation coefficient is used for correlation analysis in this paper, and the formula is as follows [23]:(5)R=∑1nXi−XYi−Y∑1nYi−Y¯2∑1nXi−X¯2.After the analysis, this paper finally selects the number of public security cases, holiday data, climate score, and community second-hand housing prices as the input characteristic attribute of the prediction model to build the number of community security cases.


## 3.3. Case Prediction Model Based on Convolutional Neural Network

### 3.3.1. Construction of Convolutional Neural Network Model

To predict the number of community security cases, first of all, it is necessary to identify the various factors associated with the risk of community policing. Then, the characteristics of data source are analyzed. Finally, the characteristic attributes that have the greatest impact on community security risk are selected, including the number of community daily security cases, climate data of H City, community second-hand housing prices, and holiday data.The prediction accuracy of community security cases depends on whether the extraction of characteristic attributes is reasonable. The traditional convolutional neural network can only extract local feature, so it is necessary to improve it. This paper proposes an autoregressive multichannel convolutional neural network model. There are input layer, convolution layer, maximum pooling layer, flatten layer, dropout layer, and full connection layer in the model. At the same time, the DenseNet is deployed behind the full connection layer to achieve the connection of different layers and the connection of each feature maps [24–26]. It can be seen that the gradient disappearance problem can be effectively suppressed.Using the convolution neural network for prediction, the input attribute features will directly affect the predictions. Therefore, improving the traditional neural network model from the input layer, the multichannel convolutional neural network prediction model can be obtained. And there are outstanding advantages for the improved model, the wider receptive field, and the higher prediction accuracy.The structure of traditional convolutional neural network model and multichannel convolutional neural network model is shown in Figure4.Figure 4
The structure of convolutional neural network.The first step is to compile dataset. The input data needs to be transformed into a 7 × 4 matrix. Where the seven rows, respectively, represent the data of each day in the previous seven days, and the four columns, respectively, represent the extracted four feature datasets. The data input to the model can be expressed as1,4, and 7. Here, “1” represents a sample, “7” represents the continuous data of the previous seven days, and “4” represents the variable dimension.The second step is to establish the deep convolutional neural network. First, using the one-dimensional convolution kernel to extract the feature of variable vectorVi=D1,D2,D3,D4,D5,D6,D7 in input layer Li. Then, build a one-dimensional convolution nuclear feature extractor, and there are 32 convolution kernels of size equal to 3. What is more, the activation function is ReLU function.The convolution layer is connected to a convolution kernel with a one-dimensional size equal to 3 and then connected to a maximum pooling layer with a one-dimensional size equal to 2. After that the flatten is performed on the extracted features to obtain the flattening layerFi.There are two full-connect layers D1 and D2 connected after the flattening level. Both use the ReLU function. And there are 200 and 100 neurons, respectively, within the hierarchy. After the full-connection layer D2, an output layer is connected, which contains only one neuron, corresponding to the data values of the prediction day.The third step is to train and verify the model. After the deep convolutional neural network is established, it is also necessary to train it with the training set. The closer the model value is to the observation value, the smaller the mean square error (MSE) is. After the model training is completed, the test set is predicted by the model to verify the model prediction accuracy. The ReLU function is used as the activation function, which can effectively avoid the problem of gradient disappearance in the process of model training.After establishing the autoregressive multichannel convolutional neural network model and the completing the model training and verification, the N-dimensional vector of the next day (i.e., the eighth day) is predicted by using the community feature vector of the previous seven days. And the new feature vector is finally output by window sliding.Considering that both the input and output data of the model are multiples of 7, it is necessary to perform data cutting. The initial and predicted datasets are represented as follows:(6)A11A12A13A14A15A16A17,A21A22A23A24A25A26A27,.......An1An2An3An4An5An6An7,⟶A18,A28,.......Aa8,,A12A13A14A15A16A17A18,A22A23A24A25A26A27A28,.......An2An3An4An5An6An7An8,⟶A19,A29,.......Aa9,,where A11A12A13A14A15A16A17 represents a feature of the first seven days, n rows represent n features of a week, and the feature vector of the predicted eighth day is on the right. After the prediction results of day eight are obtained, the feature vectors of day nine can be predicted by window sliding, as shown in formula (6). Therefore, long-term prediction can be performed by window sliding.


## 3.3.1. Construction of Convolutional Neural Network Model

To predict the number of community security cases, first of all, it is necessary to identify the various factors associated with the risk of community policing. Then, the characteristics of data source are analyzed. Finally, the characteristic attributes that have the greatest impact on community security risk are selected, including the number of community daily security cases, climate data of H City, community second-hand housing prices, and holiday data.The prediction accuracy of community security cases depends on whether the extraction of characteristic attributes is reasonable. The traditional convolutional neural network can only extract local feature, so it is necessary to improve it. This paper proposes an autoregressive multichannel convolutional neural network model. There are input layer, convolution layer, maximum pooling layer, flatten layer, dropout layer, and full connection layer in the model. At the same time, the DenseNet is deployed behind the full connection layer to achieve the connection of different layers and the connection of each feature maps [24–26]. It can be seen that the gradient disappearance problem can be effectively suppressed.Using the convolution neural network for prediction, the input attribute features will directly affect the predictions. Therefore, improving the traditional neural network model from the input layer, the multichannel convolutional neural network prediction model can be obtained. And there are outstanding advantages for the improved model, the wider receptive field, and the higher prediction accuracy.The structure of traditional convolutional neural network model and multichannel convolutional neural network model is shown in Figure4.Figure 4
The structure of convolutional neural network.The first step is to compile dataset. The input data needs to be transformed into a 7 × 4 matrix. Where the seven rows, respectively, represent the data of each day in the previous seven days, and the four columns, respectively, represent the extracted four feature datasets. The data input to the model can be expressed as1,4, and 7. Here, “1” represents a sample, “7” represents the continuous data of the previous seven days, and “4” represents the variable dimension.The second step is to establish the deep convolutional neural network. First, using the one-dimensional convolution kernel to extract the feature of variable vectorVi=D1,D2,D3,D4,D5,D6,D7 in input layer Li. Then, build a one-dimensional convolution nuclear feature extractor, and there are 32 convolution kernels of size equal to 3. What is more, the activation function is ReLU function.The convolution layer is connected to a convolution kernel with a one-dimensional size equal to 3 and then connected to a maximum pooling layer with a one-dimensional size equal to 2. After that the flatten is performed on the extracted features to obtain the flattening layerFi.There are two full-connect layers D1 and D2 connected after the flattening level. Both use the ReLU function. And there are 200 and 100 neurons, respectively, within the hierarchy. After the full-connection layer D2, an output layer is connected, which contains only one neuron, corresponding to the data values of the prediction day.The third step is to train and verify the model. After the deep convolutional neural network is established, it is also necessary to train it with the training set. The closer the model value is to the observation value, the smaller the mean square error (MSE) is. After the model training is completed, the test set is predicted by the model to verify the model prediction accuracy. The ReLU function is used as the activation function, which can effectively avoid the problem of gradient disappearance in the process of model training.After establishing the autoregressive multichannel convolutional neural network model and the completing the model training and verification, the N-dimensional vector of the next day (i.e., the eighth day) is predicted by using the community feature vector of the previous seven days. And the new feature vector is finally output by window sliding.Considering that both the input and output data of the model are multiples of 7, it is necessary to perform data cutting. The initial and predicted datasets are represented as follows:(6)A11A12A13A14A15A16A17,A21A22A23A24A25A26A27,.......An1An2An3An4An5An6An7,⟶A18,A28,.......Aa8,,A12A13A14A15A16A17A18,A22A23A24A25A26A27A28,.......An2An3An4An5An6An7An8,⟶A19,A29,.......Aa9,,where A11A12A13A14A15A16A17 represents a feature of the first seven days, n rows represent n features of a week, and the feature vector of the predicted eighth day is on the right. After the prediction results of day eight are obtained, the feature vectors of day nine can be predicted by window sliding, as shown in formula (6). Therefore, long-term prediction can be performed by window sliding.


## 4. Analysis of Experimental Results

### 4.1. Optimal Parameter Optimization

The parameter settings of convolutional neural networks are directly related to the advantages and disadvantages of the prediction results, and parameters are experimentally tuned to determine a set of optimal parameter combinations that can achieve the best prediction performance.The correlation coefficient (R), determination coefficient (R-squared), root mean square error (RMSE), and other evaluation indicators are used to achieve quantitative evaluation. Among them, the larger the R and R2 values are, the smaller the error between the predicted value and the actual value is, so the higher the prediction accuracy of the model is. RMSE represents the amount of deviation between the predicted value and the actual value. The smaller RMSE is, the closer the predicted value is to the observed value.


#### 4.1.1. Parameter Optimization of Convolution Layer

The established convolutional neural network model contains two convolution layers. And it is compared with the convolutional neural network model with one convolution layer. The experimental results are listed in Table1.Table 1
Comparison of experimental results for different convolution layers.
The number of convolution layersRR-squaredRMSEConv. layer = 10.96430.92990.8799Conv. layer = 20.96920.93910.8192After the convolution layer changed from 2 to 1, the correlation coefficientR in the model evaluation results is decreased by 2%; the determination coefficient R-squared is decreased by 1%; and the root mean square error is increased by 0.06. This indicates that the prediction accuracy of the model containing two convolution layers is higher, so the optimal parameter of the convolution layer of the convolutional neural network model is two layers.


#### 4.1.2. Convolution Kernel Parameter Optimization

The function of convolution kernels is to extract feature vectors, and the number of convolution kernels directly affects the network framework performance. In general, appropriately increasing the number of convolution kernels is conducive to extract the feature more fully. However, if the number of convolution kernels is too large, it may induce the overfitting problem. This experiment compares and analyzes the prediction performance of two types of convolutional neural network models with convolution kernels 32 and 16, respectively. The experimental results are shown in Table2.Table 2
Comparison of experimental results for different convolution kernel.
The number of convolution kernelsRR-squaredRMSE320.96920.93910.8192160.95420.91060.8389Here, the correlation coefficientR corresponding to the prediction model with 16 convolution kernels is equal to 0.9542, which is 1% lower than that of the prediction model containing 32 convolution kernels. Similarly, the determination coefficient R2 also decreases, while the root mean square error increases by 0.02. It can be seen that the prediction performance of the convolutional neural network model with 32 convolution kernels is better than that of the convolutional neural network model with 16 convolution kernels.


#### 4.1.3. Optimization of Activation Function

ReLU function and tanh function are common nonlinear activation functions, where the ReLU function has the advantages of high operation efficiency, effective avoidance of gradient explosion, gradient disappearance, and overfitting. The tanh function has the characteristics of fast convergence, which can map the output results to the interval [−1, 1]. If the input value is too large or too small, the activation function is saturated. In order to test the application effect of ReLU function, this experiment compares the performance of the tanh function, and the results are shown in Table3.Table 3
Comparison of experimental results for different activation functions.
Activate functionRR-squaredRMSEReLU0.96920.93910.8192tanh0.94690.89681.0677It can be seen that the correlation coefficientR corresponding to the network model of using ReLU activation function is higher than the network model of using tanh activation function. And the determination coefficient R-squared is 4% higher, but the root mean square error is smaller, which indicates that using ReLU activation function can better improve the prediction effect of the convolutional neural network model.


#### 4.1.4. Optimizer Optimization

At present Adam is the most widely used optimizer. It not only has the advantages of low memory footprint and fast convergence but also can adapt to application scenarios such as high-dimensional space, large datasets, and so on. In addition to Adam, RMSprop is another common optimizer. By comparing and analyzing Adam and RMSprop, the optimizer optimization of prediction model is completed. The test results are listed in Table4.Table 4
Comparison of experimental results for different optimizer.
OptimizerRR-squaredRMSEAdam0.96920.93910.8192RMSprop0.95940.92060.8789What can be seen that the correlation coefficient (R), determination coefficient (R-squared), and other indicators of the network model using Adam optimizer are higher than those using RMSprop optimizer, and the root mean square error (RMSE) is smaller, which indicates that Adam optimizer has better performance in this experiment.


#### 4.1.5. Optimization of Pooling Layer

Pooling layer can improve the generalization ability of the model. It can avoid the problem of overfitting in the process of model prediction and maintain the stability of the feature vector. The max pooling layer is adopted to compare with average pooling layer in this experiment. The experimental results are shown in Table5.Table 5
Comparison of experimental results for different pooling layer.
Pooling layerRR-squaredRMSEMax pooling0.96920.93910.8192Average pooling0.96780.93680.8354The results show that the correlation coefficientR and judgment coefficient R-squared corresponding to max pooling have a small difference with average pooling. However, the root mean square error corresponding to max pooling is significantly smaller than average pooling. Therefore, The convolution neural network model in this paper selects max pooling to obtain more accurate prediction results. After the parameter optimization, the hyperparameter combination scheme of multichannel convolutional neural network model is finally determined: 2 convolution layers, 32 convolution kernels, max pooling, ReLU activation function, and Adam optimizer. Dropout = 0.5. In addition, considering the training set is small, the number of training cycles epoch is equal to 20 and the number of single batch training batch size is equal to 4.


### 4.2. Prediction Results of Autoregressive Multichannel Convolutional Neural Network Model

Figure5 shows the comparison of the prediction results with the actual observations of the autoregressive multichannel convolutional neural network model, where the blue line and the red line coincide in many positions, it shows that this model prediction accuracy is higher. In addition, the third peak of the red line means the predicted value of the model, which deviates from the actual observations by a small amount.Figure 5
Comparison of CNN prediction model results.The LSTM prediction model and logistic regression model are compared to objectively define the prediction performance of the autoregressive multichannel convolutional neural network model established in this paper, and the results are listed in Figure6. For the evaluation indicators, the R-squared value is 77.1% and the RMSE value is 0.857.Figure 6
Comparison of prediction results of community security caseload.Here, the determined error R-squared of the proposed model is higher than that of the other two kinds of prediction models, and the root mean square error is smaller, which indicates that the overall prediction performance of the model in this paper is better.


### 4.3. Comprehensive Prediction Effect

Considering that the single prediction model can only produce the ideal performance in a specific task environment, the task characteristics are adopted to assign the corresponding weight strategy for each single prediction model, so as to establish a comprehensive prediction model that can be applied to many task environments.


#### 4.3.1. Construction of Comprehensive Prediction Model

Based on the idea of ensemble learning, the training set is used to synchronically train the multichannel convolutional neural network model and CART regression tree model, and the community security risks are predicted, respectively. Then, the output values of the two single prediction models are listed as the input values of the comprehensive prediction model to obtain the final prediction results.The comprehensive prediction model is constructed as follows.First, use the original feature data to train the two single modelsSecond, label the new features of the trained single model as Out1 and Out2, respectivelyThird, integrate the original feature data and the two new feature Out1 and Out2 data, and then, output the new feature data, namely, Out3.Fourth, input the Out3 data into the comprehensive prediction model, and the comprehensive prediction model selects suitable models according to the feature conditions to train Out3 data more fullyThe neural network structure of the comprehensive prediction model is shown in Figure7.Figure 7
The neural network structure of the comprehensive prediction model.As shown in Figure 7, the neural network structure contains three input values, namely, feature vector, Out1 data, Out2 data, and two hidden layers. Each of the hidden layers contains two neurons and four neurons, respectively. In addition, the output layer in the neural network structure contains one neuron, and the output value is the actual label value.Neural network model can integrate information from different sources and accurately simulate nonlinear relationship. Multiple single models are integrated under the framework of neural network, and the relationship between each single model is not complicated. In the multilayer sensor, the layers are fully connected, with the input layer at the bottom, the hidden layer in the middle, and the output layer at the end. In practical applications, the gradient descent method (SGD) is usually used for parameter optimization. Its implementation steps are as follows: first, initialize the parameters, and then perform the iterative training. At the same time, the gradient parameters are updated until the termination condition is reached.


#### 4.3.2. Analysis of Experimental Results

The comparison between the prediction results of the comprehensive prediction model on the test set and the actual observed values is shown in Figure8.Figure 8
Comparison of comprehensive prediction model results.The ordinates in Figure8 are the community policing caseloads, the horizontal coordinates are the date, the blue line represents the actual observations, and the black line represents the comprehensive model prediction values. It can be seen that the extension trend of the blue line and the black line is consistent, and the number of coincidence points of the blue line and the black line are more than the number of coincidence points corresponding to the two single prediction models. Therefore, it can be judged that the prediction performance of the comprehensive prediction model is better than that of the two single prediction models. In terms of model evaluation index, the R value of the comprehensive prediction model on the test set is 92.5%, R-squared value is 85.5%, and the RMSE value is 0.703. The correlation between the prediction value and the actual value is high, and the comprehensive prediction model can obtain the excellent prediction performance.The prediction accuracy of the three prediction models on the same dataset is listed in Figure9.Figure 9
Comparison of prediction accuracy of the three prediction models.Figure9 shows that the R values of the three prediction models are greater. The R values of the multichannel convolutional neural network model are higher than that of the CART regression tree model, and the mean square error is lower. Therefore, the prediction performance of the multichannel convolutional neural network model is better. In addition, the R value of the comprehensive prediction model is higher than that of the multichannel convolutional neural network model, and the mean square error is lower, so the prediction performance of the comprehensive prediction model is better.


## 4.1. Optimal Parameter Optimization

The parameter settings of convolutional neural networks are directly related to the advantages and disadvantages of the prediction results, and parameters are experimentally tuned to determine a set of optimal parameter combinations that can achieve the best prediction performance.The correlation coefficient (R), determination coefficient (R-squared), root mean square error (RMSE), and other evaluation indicators are used to achieve quantitative evaluation. Among them, the larger the R and R2 values are, the smaller the error between the predicted value and the actual value is, so the higher the prediction accuracy of the model is. RMSE represents the amount of deviation between the predicted value and the actual value. The smaller RMSE is, the closer the predicted value is to the observed value.


### 4.1.1. Parameter Optimization of Convolution Layer

The established convolutional neural network model contains two convolution layers. And it is compared with the convolutional neural network model with one convolution layer. The experimental results are listed in Table1.Table 1
Comparison of experimental results for different convolution layers.
The number of convolution layersRR-squaredRMSEConv. layer = 10.96430.92990.8799Conv. layer = 20.96920.93910.8192After the convolution layer changed from 2 to 1, the correlation coefficientR in the model evaluation results is decreased by 2%; the determination coefficient R-squared is decreased by 1%; and the root mean square error is increased by 0.06. This indicates that the prediction accuracy of the model containing two convolution layers is higher, so the optimal parameter of the convolution layer of the convolutional neural network model is two layers.


### 4.1.2. Convolution Kernel Parameter Optimization

The function of convolution kernels is to extract feature vectors, and the number of convolution kernels directly affects the network framework performance. In general, appropriately increasing the number of convolution kernels is conducive to extract the feature more fully. However, if the number of convolution kernels is too large, it may induce the overfitting problem. This experiment compares and analyzes the prediction performance of two types of convolutional neural network models with convolution kernels 32 and 16, respectively. The experimental results are shown in Table2.Table 2
Comparison of experimental results for different convolution kernel.
The number of convolution kernelsRR-squaredRMSE320.96920.93910.8192160.95420.91060.8389Here, the correlation coefficientR corresponding to the prediction model with 16 convolution kernels is equal to 0.9542, which is 1% lower than that of the prediction model containing 32 convolution kernels. Similarly, the determination coefficient R2 also decreases, while the root mean square error increases by 0.02. It can be seen that the prediction performance of the convolutional neural network model with 32 convolution kernels is better than that of the convolutional neural network model with 16 convolution kernels.


### 4.1.3. Optimization of Activation Function

ReLU function and tanh function are common nonlinear activation functions, where the ReLU function has the advantages of high operation efficiency, effective avoidance of gradient explosion, gradient disappearance, and overfitting. The tanh function has the characteristics of fast convergence, which can map the output results to the interval [−1, 1]. If the input value is too large or too small, the activation function is saturated. In order to test the application effect of ReLU function, this experiment compares the performance of the tanh function, and the results are shown in Table3.Table 3
Comparison of experimental results for different activation functions.
Activate functionRR-squaredRMSEReLU0.96920.93910.8192tanh0.94690.89681.0677It can be seen that the correlation coefficientR corresponding to the network model of using ReLU activation function is higher than the network model of using tanh activation function. And the determination coefficient R-squared is 4% higher, but the root mean square error is smaller, which indicates that using ReLU activation function can better improve the prediction effect of the convolutional neural network model.


### 4.1.4. Optimizer Optimization

At present Adam is the most widely used optimizer. It not only has the advantages of low memory footprint and fast convergence but also can adapt to application scenarios such as high-dimensional space, large datasets, and so on. In addition to Adam, RMSprop is another common optimizer. By comparing and analyzing Adam and RMSprop, the optimizer optimization of prediction model is completed. The test results are listed in Table4.Table 4
Comparison of experimental results for different optimizer.
OptimizerRR-squaredRMSEAdam0.96920.93910.8192RMSprop0.95940.92060.8789What can be seen that the correlation coefficient (R), determination coefficient (R-squared), and other indicators of the network model using Adam optimizer are higher than those using RMSprop optimizer, and the root mean square error (RMSE) is smaller, which indicates that Adam optimizer has better performance in this experiment.


### 4.1.5. Optimization of Pooling Layer

Pooling layer can improve the generalization ability of the model. It can avoid the problem of overfitting in the process of model prediction and maintain the stability of the feature vector. The max pooling layer is adopted to compare with average pooling layer in this experiment. The experimental results are shown in Table5.Table 5
Comparison of experimental results for different pooling layer.
Pooling layerRR-squaredRMSEMax pooling0.96920.93910.8192Average pooling0.96780.93680.8354The results show that the correlation coefficientR and judgment coefficient R-squared corresponding to max pooling have a small difference with average pooling. However, the root mean square error corresponding to max pooling is significantly smaller than average pooling. Therefore, The convolution neural network model in this paper selects max pooling to obtain more accurate prediction results. After the parameter optimization, the hyperparameter combination scheme of multichannel convolutional neural network model is finally determined: 2 convolution layers, 32 convolution kernels, max pooling, ReLU activation function, and Adam optimizer. Dropout = 0.5. In addition, considering the training set is small, the number of training cycles epoch is equal to 20 and the number of single batch training batch size is equal to 4.


## 4.1.1. Parameter Optimization of Convolution Layer

The established convolutional neural network model contains two convolution layers. And it is compared with the convolutional neural network model with one convolution layer. The experimental results are listed in Table1.Table 1
Comparison of experimental results for different convolution layers.
The number of convolution layersRR-squaredRMSEConv. layer = 10.96430.92990.8799Conv. layer = 20.96920.93910.8192After the convolution layer changed from 2 to 1, the correlation coefficientR in the model evaluation results is decreased by 2%; the determination coefficient R-squared is decreased by 1%; and the root mean square error is increased by 0.06. This indicates that the prediction accuracy of the model containing two convolution layers is higher, so the optimal parameter of the convolution layer of the convolutional neural network model is two layers.


## 4.1.2. Convolution Kernel Parameter Optimization

The function of convolution kernels is to extract feature vectors, and the number of convolution kernels directly affects the network framework performance. In general, appropriately increasing the number of convolution kernels is conducive to extract the feature more fully. However, if the number of convolution kernels is too large, it may induce the overfitting problem. This experiment compares and analyzes the prediction performance of two types of convolutional neural network models with convolution kernels 32 and 16, respectively. The experimental results are shown in Table2.Table 2
Comparison of experimental results for different convolution kernel.
The number of convolution kernelsRR-squaredRMSE320.96920.93910.8192160.95420.91060.8389Here, the correlation coefficientR corresponding to the prediction model with 16 convolution kernels is equal to 0.9542, which is 1% lower than that of the prediction model containing 32 convolution kernels. Similarly, the determination coefficient R2 also decreases, while the root mean square error increases by 0.02. It can be seen that the prediction performance of the convolutional neural network model with 32 convolution kernels is better than that of the convolutional neural network model with 16 convolution kernels.


## 4.1.3. Optimization of Activation Function

ReLU function and tanh function are common nonlinear activation functions, where the ReLU function has the advantages of high operation efficiency, effective avoidance of gradient explosion, gradient disappearance, and overfitting. The tanh function has the characteristics of fast convergence, which can map the output results to the interval [−1, 1]. If the input value is too large or too small, the activation function is saturated. In order to test the application effect of ReLU function, this experiment compares the performance of the tanh function, and the results are shown in Table3.Table 3
Comparison of experimental results for different activation functions.
Activate functionRR-squaredRMSEReLU0.96920.93910.8192tanh0.94690.89681.0677It can be seen that the correlation coefficientR corresponding to the network model of using ReLU activation function is higher than the network model of using tanh activation function. And the determination coefficient R-squared is 4% higher, but the root mean square error is smaller, which indicates that using ReLU activation function can better improve the prediction effect of the convolutional neural network model.


## 4.1.4. Optimizer Optimization

At present Adam is the most widely used optimizer. It not only has the advantages of low memory footprint and fast convergence but also can adapt to application scenarios such as high-dimensional space, large datasets, and so on. In addition to Adam, RMSprop is another common optimizer. By comparing and analyzing Adam and RMSprop, the optimizer optimization of prediction model is completed. The test results are listed in Table4.Table 4
Comparison of experimental results for different optimizer.
OptimizerRR-squaredRMSEAdam0.96920.93910.8192RMSprop0.95940.92060.8789What can be seen that the correlation coefficient (R), determination coefficient (R-squared), and other indicators of the network model using Adam optimizer are higher than those using RMSprop optimizer, and the root mean square error (RMSE) is smaller, which indicates that Adam optimizer has better performance in this experiment.


## 4.1.5. Optimization of Pooling Layer

Pooling layer can improve the generalization ability of the model. It can avoid the problem of overfitting in the process of model prediction and maintain the stability of the feature vector. The max pooling layer is adopted to compare with average pooling layer in this experiment. The experimental results are shown in Table5.Table 5
Comparison of experimental results for different pooling layer.
Pooling layerRR-squaredRMSEMax pooling0.96920.93910.8192Average pooling0.96780.93680.8354The results show that the correlation coefficientR and judgment coefficient R-squared corresponding to max pooling have a small difference with average pooling. However, the root mean square error corresponding to max pooling is significantly smaller than average pooling. Therefore, The convolution neural network model in this paper selects max pooling to obtain more accurate prediction results. After the parameter optimization, the hyperparameter combination scheme of multichannel convolutional neural network model is finally determined: 2 convolution layers, 32 convolution kernels, max pooling, ReLU activation function, and Adam optimizer. Dropout = 0.5. In addition, considering the training set is small, the number of training cycles epoch is equal to 20 and the number of single batch training batch size is equal to 4.


## 4.2. Prediction Results of Autoregressive Multichannel Convolutional Neural Network Model

Figure5 shows the comparison of the prediction results with the actual observations of the autoregressive multichannel convolutional neural network model, where the blue line and the red line coincide in many positions, it shows that this model prediction accuracy is higher. In addition, the third peak of the red line means the predicted value of the model, which deviates from the actual observations by a small amount.Figure 5
Comparison of CNN prediction model results.The LSTM prediction model and logistic regression model are compared to objectively define the prediction performance of the autoregressive multichannel convolutional neural network model established in this paper, and the results are listed in Figure6. For the evaluation indicators, the R-squared value is 77.1% and the RMSE value is 0.857.Figure 6
Comparison of prediction results of community security caseload.Here, the determined error R-squared of the proposed model is higher than that of the other two kinds of prediction models, and the root mean square error is smaller, which indicates that the overall prediction performance of the model in this paper is better.


## 4.3. Comprehensive Prediction Effect

Considering that the single prediction model can only produce the ideal performance in a specific task environment, the task characteristics are adopted to assign the corresponding weight strategy for each single prediction model, so as to establish a comprehensive prediction model that can be applied to many task environments.


### 4.3.1. Construction of Comprehensive Prediction Model

Based on the idea of ensemble learning, the training set is used to synchronically train the multichannel convolutional neural network model and CART regression tree model, and the community security risks are predicted, respectively. Then, the output values of the two single prediction models are listed as the input values of the comprehensive prediction model to obtain the final prediction results.The comprehensive prediction model is constructed as follows.First, use the original feature data to train the two single modelsSecond, label the new features of the trained single model as Out1 and Out2, respectivelyThird, integrate the original feature data and the two new feature Out1 and Out2 data, and then, output the new feature data, namely, Out3.Fourth, input the Out3 data into the comprehensive prediction model, and the comprehensive prediction model selects suitable models according to the feature conditions to train Out3 data more fullyThe neural network structure of the comprehensive prediction model is shown in Figure7.Figure 7
The neural network structure of the comprehensive prediction model.As shown in Figure 7, the neural network structure contains three input values, namely, feature vector, Out1 data, Out2 data, and two hidden layers. Each of the hidden layers contains two neurons and four neurons, respectively. In addition, the output layer in the neural network structure contains one neuron, and the output value is the actual label value.Neural network model can integrate information from different sources and accurately simulate nonlinear relationship. Multiple single models are integrated under the framework of neural network, and the relationship between each single model is not complicated. In the multilayer sensor, the layers are fully connected, with the input layer at the bottom, the hidden layer in the middle, and the output layer at the end. In practical applications, the gradient descent method (SGD) is usually used for parameter optimization. Its implementation steps are as follows: first, initialize the parameters, and then perform the iterative training. At the same time, the gradient parameters are updated until the termination condition is reached.


### 4.3.2. Analysis of Experimental Results

The comparison between the prediction results of the comprehensive prediction model on the test set and the actual observed values is shown in Figure8.Figure 8
Comparison of comprehensive prediction model results.The ordinates in Figure8 are the community policing caseloads, the horizontal coordinates are the date, the blue line represents the actual observations, and the black line represents the comprehensive model prediction values. It can be seen that the extension trend of the blue line and the black line is consistent, and the number of coincidence points of the blue line and the black line are more than the number of coincidence points corresponding to the two single prediction models. Therefore, it can be judged that the prediction performance of the comprehensive prediction model is better than that of the two single prediction models. In terms of model evaluation index, the R value of the comprehensive prediction model on the test set is 92.5%, R-squared value is 85.5%, and the RMSE value is 0.703. The correlation between the prediction value and the actual value is high, and the comprehensive prediction model can obtain the excellent prediction performance.The prediction accuracy of the three prediction models on the same dataset is listed in Figure9.Figure 9
Comparison of prediction accuracy of the three prediction models.Figure9 shows that the R values of the three prediction models are greater. The R values of the multichannel convolutional neural network model are higher than that of the CART regression tree model, and the mean square error is lower. Therefore, the prediction performance of the multichannel convolutional neural network model is better. In addition, the R value of the comprehensive prediction model is higher than that of the multichannel convolutional neural network model, and the mean square error is lower, so the prediction performance of the comprehensive prediction model is better.


## 4.3.1. Construction of Comprehensive Prediction Model

Based on the idea of ensemble learning, the training set is used to synchronically train the multichannel convolutional neural network model and CART regression tree model, and the community security risks are predicted, respectively. Then, the output values of the two single prediction models are listed as the input values of the comprehensive prediction model to obtain the final prediction results.The comprehensive prediction model is constructed as follows.First, use the original feature data to train the two single modelsSecond, label the new features of the trained single model as Out1 and Out2, respectivelyThird, integrate the original feature data and the two new feature Out1 and Out2 data, and then, output the new feature data, namely, Out3.Fourth, input the Out3 data into the comprehensive prediction model, and the comprehensive prediction model selects suitable models according to the feature conditions to train Out3 data more fullyThe neural network structure of the comprehensive prediction model is shown in Figure7.Figure 7
The neural network structure of the comprehensive prediction model.As shown in Figure 7, the neural network structure contains three input values, namely, feature vector, Out1 data, Out2 data, and two hidden layers. Each of the hidden layers contains two neurons and four neurons, respectively. In addition, the output layer in the neural network structure contains one neuron, and the output value is the actual label value.Neural network model can integrate information from different sources and accurately simulate nonlinear relationship. Multiple single models are integrated under the framework of neural network, and the relationship between each single model is not complicated. In the multilayer sensor, the layers are fully connected, with the input layer at the bottom, the hidden layer in the middle, and the output layer at the end. In practical applications, the gradient descent method (SGD) is usually used for parameter optimization. Its implementation steps are as follows: first, initialize the parameters, and then perform the iterative training. At the same time, the gradient parameters are updated until the termination condition is reached.


## 4.3.2. Analysis of Experimental Results

The comparison between the prediction results of the comprehensive prediction model on the test set and the actual observed values is shown in Figure8.Figure 8
Comparison of comprehensive prediction model results.The ordinates in Figure8 are the community policing caseloads, the horizontal coordinates are the date, the blue line represents the actual observations, and the black line represents the comprehensive model prediction values. It can be seen that the extension trend of the blue line and the black line is consistent, and the number of coincidence points of the blue line and the black line are more than the number of coincidence points corresponding to the two single prediction models. Therefore, it can be judged that the prediction performance of the comprehensive prediction model is better than that of the two single prediction models. In terms of model evaluation index, the R value of the comprehensive prediction model on the test set is 92.5%, R-squared value is 85.5%, and the RMSE value is 0.703. The correlation between the prediction value and the actual value is high, and the comprehensive prediction model can obtain the excellent prediction performance.The prediction accuracy of the three prediction models on the same dataset is listed in Figure9.Figure 9
Comparison of prediction accuracy of the three prediction models.Figure9 shows that the R values of the three prediction models are greater. The R values of the multichannel convolutional neural network model are higher than that of the CART regression tree model, and the mean square error is lower. Therefore, the prediction performance of the multichannel convolutional neural network model is better. In addition, the R value of the comprehensive prediction model is higher than that of the multichannel convolutional neural network model, and the mean square error is lower, so the prediction performance of the comprehensive prediction model is better.


## 5. Conclusion

According to the prediction results of the three models for the number of security cases of community Z, although all kinds of models can achieve ideal prediction accuracy, the prediction accuracy of the comprehensive prediction model is higher than that of the convolutional neural network model and the CART regression tree prediction model. Furthermore, our research also provides a new information approach for the current community security governance.



---

*Source: 8676124-2022-02-17.xml*