Research of Email Classification based on Deep Neural Network

## Publications

/ Export Citation / / / Text size:

#### International Journal of Advanced Network, Monitoring and Controls

Xi'an Technological University

Subject: Computer Science , Software Engineering

eISSN: 2470-8038

20
44
Visit(s)
0
Comment(s)
0
Share(s)

SEARCH WITHIN CONTENT

FIND ARTICLE

Volume / Issue / page

Archive
Volume 5 (2020)
Volume 4 (2019)
Volume 3 (2018)
Volume 2 (2017)
Volume 1 (2016)
Related articles

VOLUME 3 , ISSUE 2 (May 2018) > List of articles

### Research of Email Classification based on Deep Neural Network

Citation Information : International Journal of Advanced Network, Monitoring and Controls. Volume 3, Issue 2, Pages 17-21, DOI: https://doi.org/10.21307/ijanmc-2018-038

Published Online: 07-May-2018

### ARTICLE

#### ABSTRACT

The effective distinction between normal email and spam, so as to maximize the possible of filtering spam has become a research hotspot currently. Naive bayes algorithm is a kind of frequently-used email classification and it is a statistical-based classification algorithm. It assumes that the attributes are independent of each other when given the target value. This hypothesis is apparently impossible in the email classification, so the accuracy of email classification based on naive bayes algorithm is low. In allusion to the problem of poor accuracy of email classification based on naive bayes algorithm, scholars have proposed some new email classification algorithms. The email classification algorithm based on deep neural network is one kind of them. The deep neural network is an artificial neural network with full connection between layer and layer. The algorithm extracted the email feature from the training email samples and constructed a DNN with multiple hidden layers, the DNN classifier was generated by training samples, and finally the testing emails were classified, and they were marked whether they were spam or not. In order to verify the effect of the email classification algorithm based on DNN, in this paper we constructed a DNN with 2 hidden layers. The number of nodes in each hidden layer was 30. When the training set was trained, we set up 2000 batches, and each batch has 3 trained data. We used the famous Spam Base dataset as the data set. The experiment result showed that DNN was higher than naive Bayes in the accuracy of email classification when the proportion of the training set was 10%, 20%, 30%, 40% and 50% respectively, and DNN showed a good classification effect. With the development of science and technology, spam manifests in many forms and the damage of it is more serious, this puts forward higher requirements for the accuracy of spam recognition. The focus of next research will be combining various algorithms to further improve the effect of email classification.

## I. INTRODUCTION

Email has become a major way of communication for people at present, but the problem of spam comes behind. The harm of spam is mainly manifested as the following aspects: occupying bandwidth, leading to the congestion of the email server and reducing the efficiency of the network; consuming the time of the user and affecting the work efficiency. Therefore, the effective distinction between normal email and spam, so as to maximize the possible of filtering spam has become a research hotspot currently.

Naive bayes algorithm is a kind of frequently-used email classification and it is a statistical-based classification algorithm[1-3], which has the characteristics of simple realization and fast classification. However, it assumes that the attributes are independent of each other when given the target value[4]. This hypothesis is apparently impossible in the email classification, so the accuracy of email classification based on naive bayes algorithm is low. In allusion to the problem of poor accuracy of email classification based on naive bayes algorithm, scholars have proposed some new email classification algorithms. The email classification algorithm based on deep neural network (DNN) is one kind of them.

## II. THEORETICAL BASIS

The basic concept of artificial neural network is based on the hypothesis and model construction of how the human brain responds to complex problems[4-6]. The deep neural network is an artificial neural network with full connection between layer and layer, and its structure is shown in figure 1. The full connection between layer and layer means that any neuron in the ith layer must be connected to any of the neurons in the (i + 1)th layer. Although the deep neural network looks complex, it is still the same as the perceptron from a small local model.

##### Figure 1.

Structure diagram of deep neural network

We use $wjkl$ to respresent the weight coefficient between the kth neuron in the (l − 1)th layer and the jth neuron in the lth layer, $bjl$ to represent the bias of the jth neuron in the lth layer, $ajl$ to represent the activation value of the neuron in the layer. We can get the following relationship between the activation value of the jth neuron in the layerand the activation value of all neuron sin the (1 − l)th layer:

##### (1)
$ajl=σ(∑kwjk1akl-1+bjl)$

We assume that wl is the weight coefficient matrix of all the neurons in the lth layer, bl is the bias matrix of the lth layer, al is the activation value of the layer, zl is the weighted input of all neurons in the lth layer, Then $wjkl$ is the weight coefficient of row j, column k. The relationship between the activation value of the lth layer and the activation value of the (l − 1)th layer can be expressed by the following matrix relationship:

##### (2)
$al=σ(zl)=σ(wlal-1+bl)$

Here σ respresents the non-linear activation function of the nodes on the hidden layers, and the traditional DNN uses sigmoid function usually, as shown in expression (3). Because the sigmoid function has properties such as monotone increasing and its inverse function has the property of monotone increasing, it is often used as a threshold function of neural networks, It maps the variables between 0 and 1. The sigmoid function curve is shown in figure 2:

##### (3)
$σ(z)=11+e−z$

##### Figure 2.

The sigmoid function curve

## III. ALGORITHM DESCRIPTION

Implementation process of mail classification algorithm based on deep neural network was shown in Figure 3.

##### Figure 3.

Algorithm execution process

• Step 1: Read the contents of the email for training from the Spam Base dataset and extract the email features for training such as word_freq_, char_freq_, capital_run_length_average, capital_run_length_longest, capital_run_length_total, and so on.

• Step 2: Construct a DNN containing multiple hidden layers, set the number of hidden layers (n_classes), set the number of nodes on each layer (hidden_units), set training batches (steps) and the number of training data for each batch (batch_size).

• Step 3: Train DNN to generate DNN classifier.

• Step 4: Read the contents of the email for testing from the SpamBase data set and extract the email features for testing such as word_freq_, char_freq_, capital_run_length_average, capital_run_length_longest, capital_run_length_total, and so on.

• Step 5: Use the DNN classifier to classify the testing email and mark whether they are spam (1 or 0).

• Step 6: Compare the classification result of the email (y_predict) with the actual tag (y_test), calculate the accuracy of the algorithm in the email classification (accuracy_score) and verify the correctness of the algorithm.

## IV. EXPERIMENTAL RESULTS AND ANALYSIS

In order to verify the effect of the email classification algorithm based on DNN, in this paper we constructeda DNN with 2 hidden layers. The number of nodes in each hidden layer was 30. When the training set was trained, we set up 2000 batches, and each batch has 3 trained data. We used the famous SpamBase dataset as the data set, which was from the UCI machine learning library at the University of California, USA. The specific situation is shown in table I.

##### TABLE I.

SPAMBASE DATA SET

We compared the two kinds of email filtering algorithms of DNN and naive Bayes with accuracy, which is the main evaluation standard of email filtering technology. The accuracy is defined as follows:

##### (4)

We did five groups of experiments in this paper.The selection case of training set and testing set in each experiment is shown in table II.

##### TABLE II.

THE SELECTION CASE OF TRAINING SET AND TESTING SET

The experimental results were shown in Figure 4.

##### Figure 4.

The comparison of accuracy of the two algorithms

The experiment result showed that DNN was higher than naive Bayes in the accuracy of email classification when the proportion of the training set was 10%, 20%, 30%, 40% and 50% respectively, and DNN showed a good classification effect.

## V. CONCLUSION

The application of email classification algorithm based on deep neural network is studied in this paper. The algorithm constructed multiple hidden layers and generated DNN classifiers through training. The experiment results showed that the accuracy of the algorithm is obviously higher than the naive Bayes algorithm.

With the development of science and technology, spam manifests in many forms and the damage of it is more serious, this puts forward higher requirements for the accuracy of spam recognition. The focus of next research will becombining various algorithms to further improve the effect of email classification.

## ACKNOWLEDGMENTS

New network and detection control national joint engineering laboratory fund program (GSYSJ2016017). Xi’an Technological University Principal Scientific Research Fund Project: XAGDXJJ—1315

## References

1. Cao Cuiling, Wang Yuanyuan and Yuan Ye, “Research of a spam filter based on improved naive Bayes algorithm,” Chinese Journal of Network and Information Security, Vol. 3 No. 3, pp. 64-70, March 2017.
2. Wang Zhiyong and Liu Hongmei, “DESIGN AND IMPLEMENTATION OF BAYESIAN SPAM FILTE RING SYSTEM,” Journal of Inner Mongolia Agricultural University (Natural Science Edition), Vol. 38 No. 3, pp. 82-86, May. 2017.
3. Wang Qing Song and Wei Ruyu, “Bayesian Chinese Spam Filtering Method Based on Phrases,” Computer Science, Vol. 43 No. 4, pp. 256-259, Apr 2016.
4. Neural Networks and Deep Learning [EB/OL]. http://neuralnetworksanddeeplearning.com.
[URL]
5. Li Kun, Chai Yumei and Zhao Hongling, “Estimation of Fetal Weight Based on Deep Neural Network,” Computer Science, Vol. 43 No. 11A, pp. 73-76, Nov 2016.
6. Cao Meng, Li Hongyan and Zhao Rongrong, “A Pitch Detection Method Based on Deep Neural Network,” Microelectronics & Computer, Vol. 33 No. 6, pp. 143-146, June 2016.
7. Ren Rongrong, Zhou Mingquan and Geng Guohua, “The multi-scale features extraction method based on deep neural network”, Journal of Northwest University (Natural Science Edition), Vol. 47 No. 2, pp. 215-221, Apr 2017.
8. S.L. Zhang Research on Deep Neural Networks based Models for Speech Recognition (Ph.D., University of Science and Technology of China, China 2017), p. 35

### FIGURES & TABLES

Figure 1.

Structure diagram of deep neural network

Figure 2.

The sigmoid function curve

Figure 3.

Algorithm execution process

Figure 4.

The comparison of accuracy of the two algorithms

TABLE I.

SPAMBASE DATA SET

TABLE II.

THE SELECTION CASE OF TRAINING SET AND TESTING SET

### REFERENCES

1. Cao Cuiling, Wang Yuanyuan and Yuan Ye, “Research of a spam filter based on improved naive Bayes algorithm,” Chinese Journal of Network and Information Security, Vol. 3 No. 3, pp. 64-70, March 2017.
2. Wang Zhiyong and Liu Hongmei, “DESIGN AND IMPLEMENTATION OF BAYESIAN SPAM FILTE RING SYSTEM,” Journal of Inner Mongolia Agricultural University (Natural Science Edition), Vol. 38 No. 3, pp. 82-86, May. 2017.
3. Wang Qing Song and Wei Ruyu, “Bayesian Chinese Spam Filtering Method Based on Phrases,” Computer Science, Vol. 43 No. 4, pp. 256-259, Apr 2016.
4. Neural Networks and Deep Learning [EB/OL]. http://neuralnetworksanddeeplearning.com.
[URL]
5. Li Kun, Chai Yumei and Zhao Hongling, “Estimation of Fetal Weight Based on Deep Neural Network,” Computer Science, Vol. 43 No. 11A, pp. 73-76, Nov 2016.
6. Cao Meng, Li Hongyan and Zhao Rongrong, “A Pitch Detection Method Based on Deep Neural Network,” Microelectronics & Computer, Vol. 33 No. 6, pp. 143-146, June 2016.
7. Ren Rongrong, Zhou Mingquan and Geng Guohua, “The multi-scale features extraction method based on deep neural network”, Journal of Northwest University (Natural Science Edition), Vol. 47 No. 2, pp. 215-221, Apr 2017.
8. S.L. Zhang Research on Deep Neural Networks based Models for Speech Recognition (Ph.D., University of Science and Technology of China, China 2017), p. 35