# Deep Learning for EEG-Based Preference Classification in Neuromarketing
## 4 Proposed System for the EEG-based Preference Detection
### DNN Classification  
Deep learning has been proved as an effective tool to help make the EEG signals meaningful because of its ability to learn the feature representations from the raw data. DNNs are models consisting of the combined layers of \"neurons\" in which each layer applies a linear transformation to the input data. Then, the transformation result of each layer undergoes processing on the basis of a nonlinear cost function. The parameters of such transformations are deduced by minimizing a cost function [61]. The DNN operates in one forward direction, from the input neurons through the hidden ones (if available) to the output neurons in the forward directions. Assuming that the length window of the samples is \(s\), the input of the DNN for the EEG signals consists of a multidimensional array \(X_{i}\in\mathbb{R}^{e\times s}\) that contains \(s\) samples associated with a window for all \(e\) electrodes. The fully connected layer, which is the most common type of layer used in building a DNN, consists of fully connected neurons. The input of every neuron is the activation of each neuron from the previous layer [61].  
Our study aimed to detect two preference states in the EEG data. Therefore, we employed intelligent classification algorithms that could effectively mirror the preferences of the subjects. We proposed a DNN classifier and compared its performance with those of KNN and RF classifiers.  
The block diagram of the proposed DNN classifier is shown in Figure 6. First, the extracted features are normalized using minimum-maximum normalization (Equation (7)) and then fed into the DNN classifier.  
\[x_{-}\text{scaled}=(x-\text{min})/\left(\text{max}-\text{min}\right) \tag{7}\]  
Figure 5: The average correlations for all subjects of the valence ratings with the power of different frequency bands. The highlighted electrodes correlate significantly (\(p<0.05\)) with the valence ratings. © [2011] IEEE. Reprinted, with permission, from:_IEEE Trans. Affect. Comput., DEAP: A Database for Emotion Analysis Using Physiological Signals, [PERSON]; [PERSON]. [58]._  
In this study, the considered DNN architecture is a fully connected feed-forward neural network with three hidden layers, which contain units involving rectified linear activation functions (ReLu). The output is obtained as a soft-max layer with a binary cross-entropy cost function. The input layer consists of 2367 units, and each hidden layer consists of 75% units from its predecessor (previous) layer. In particular, the first, second, and third hidden layers involve 1800, 1300, and 800 units, respectively. The output layer dimensions pertain to the number of target preferences state (2) units. To train the DNN classifier, we used Adam gradient descent with three objective loss functions: binary cross-entropy, categorical cross-entropy, and hinge cross function. For transfer learning, we considered the reasonable defaults and followed the established best practices: the start learning rate was 0.001. Then, we linearly reduced the rate with each epoch such that the learning rate for the last epoch was 0.0001. We set the dropout for the input and hidden layers as 0.1 and 0.05, respectively. The stopping criterion of the network training was determined according to the model performance on a testing set. If the network started to over-fit, the network training was stopped. This stopping criterion is helpful for reducing the possibility of over-fitting of the validation data. The network was tested on a test set, which contained approximately 20% of the data samples in the dataset.