Cite

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.

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 w j k l to respresent the weight coefficient between the kth neuron in the (l − 1)th layer and the jth neuron in the lth layer, b j l to represent the bias of the jth neuron in the lth layer, a j l 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: a j l ( k w jk 1 a k l-1 +b j l )

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 w j k l 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: a l = σ ( z l ) = σ ( w l a l-1 + b l )

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: σ ( z ) = 1 1 + e z

Figure 2.

The sigmoid function curve

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.

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: Accuracy= Number of correctly identified email Total number of emails

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.

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.

eISSN:
2470-8038
Language:
English
Publication timeframe:
4 times per year
Journal Subjects:
Computer Sciences, other