A five-layer, sequential, long short-term memory (LSTM) neural network was developed (
Fig. 6). The LSTM network is part of a recurrent neural network that analyzes data sequences of different lengths. This type of network has the advantage of having a high capacity to receive, as input, a set of continuous values in the form of a two-dimensional matrix. In contrast, most other existing neural networks require discontinuous or discrete values. Because our eye-rubbing data consisted of temporal sequences, LSTM appeared to be the most relevant.
The model was implemented in Python using the Keras and TensorFlow libraries. The different layers are parameterized to avoid overfitting by batch normalization and dropout techniques. Overfitting is a perfect but biased adaptation of the results of the model to the training and validation dataset, not transferable to another dataset. Batch normalization
16 consists of formatting the input data of each neural network layer to obtain a 0 mean and a standard deviation of 1, making it possible to obtain more stable data belonging to the same scale. Dropout
17 works by randomly deactivating neurons during network training to exploit each neuron individually.
For each type of sensor (e.g., gyroscope, accelerometer), the model receives as input 112 types of data: accelerometer (x, y, z), gyroscope (x, y, z), gravity (x, y, z), and linear acceleration. These data types have undergone preprocessing to extract meaningful features by calculating statistical measures such as mean, standard deviation, median absolute deviation, maximum, minimum, energy, entropy, interquartile range, and correlation for each feature. This process resulted in a total of 112 features.
The dataset was then divided into 80% for the training dataset and 20% for the testing dataset and then divided for training into a series of 120 records using the Python code class generate_sequence. The interval and number of different characteristics or features (columns) were defined, passed to the class, and stored in a variable. This provided an output table of four values corresponding to the percentage prediction for each class.