# Deep Learning Stranded Neural Network Model for the Detection of Sensory Triggered Events
## 3 Materials and Methods
### Proposed Stranded-NN Model
The learning rate parameter \(\lambda_{t}\), which defines the per-strand weight adjustments over the loss function, was initially set to 0.01 for all model strands. If, while training, the strand validation loss decreases between epochs, then the \(\lambda_{t}\) is decreased by a learning rate decrease factor \(\lambda_{d}=0.2\). This is performed until the \(\lambda_{t}\) parameter reaches the value of \(10^{-4}\). Below, further \(\lambda_{t}\) decreases, triggered by validation loss decays, do not contribute significantly to the NN weights. The stranded-NN model is a collection of NN-strands, which can be used for either training or classification based on the input measurements batch size. Figure 1 illustrates the stranded model training and prediction process flow. At the initialization of the NN strands, the description configuration file is parsed, and the initial NN strands are generated and attached to the model. Upon first strand creation, the model is stored with initial weights using a separate model file per NN strand using the HDF5 data format. Upon successful model storage, the model select command can select a specific NN strand of specified data input and model depth. The stranded-NN algorithmic process includes the following steps for both models training and predictions:  
**Data Preprocessing:** The data pre-processing step includes arranging the data input streams to 1D \((n,1)\) arrays, where \(n\) is the corresponding model strand input (stranded model input batch size). The data pre-processing also includes transforming the annotated outputs to binary 1D vectors with sizes equal to the stranded model classes. After the pre-processing, the stranded model initialization occurs, which involves either the creation of the stranded model and its corresponding strands or the stranded model load (load of strands' weights). **Step 1--Training:** In this step, the selected strand is trained using the appropriate sensory batch as data input. The model uses a configurable batch size and epoch values per selected strand for the training process. The train data split ratios to validation, and testing sets are also configurable. The default value of 0.1 (10% of the training dataset) was used for the validation set. The default value of 0.2 (20% of the training dataset) was used for strand evaluation. The training data set input batches were also shuffled prior to training. Since the sensory measures were in chronological order for all input batches and were classified as a batch, the shuffling process did not affect the order of the time intervals (batch size) that we wanted to have a classification outcome. Any number can be used between 20-80 epochs for the training process epochs. However, the authors selected the size of 40 epochs, 10 epochs above the learning rate reduction initialization to be considered during the training process (fine tuning of trainable parameters). Regarding the training and evaluation batch input sizes, an arbitrary number between \(16-512\) can be selected. No significant accuracy or loss changes were detected from the batch size variations in the reported range, as reported by our experimentation. **Step 2--Classification:** In this step, the classification-class selection response of the selected strand is calculated using appropriate sensory batched data as input. **Step 3--Store NN strands:** Upon training, the new model strand weights are stored in the new model file in the NN-model strand directory. Additionally, the strand model evaluation results regarding loss and accuracy are stored in the stranded-NN model's output results file. **Step 4--Prediction vector output:** If requested, the predictions of the output layer can be separately stored before the appliance of the soft-max activation function. This output vector is called a regression or predictions vector. It can be used in order to have the unregulated output of the strand as an input to other algorithmic output correlation, similarity, or regression processes.