Keywords

12.1 Introduction

There is an increasing number of Machine Learning (ML) solutions and Deep Learning (DL) applications in biological sciences. It can be mentioned contributions in oncology [1], cardiology [2], neuroimage [3] and electroencephalography (EEG) [4] with a growing number of studies since 2018 [5]. Is not the case in NFB. There have only been described, design and tested Neural Networks (NN) and DL models for assessment the efficacy of one neurofeedback procedure [6] and the identification of the best NFB intervention [7]. Emerging field of DL models applied to analysis of peripheral biological signals has more reports, standardized procedures in cardiac electrophysiology [2], assessment of electrocardiogram (ECG) and blood pressure [8], development of prosthetic solutions for disabilities [9], decoding of motor intent in peripheral nerve signals [10], assessment of pain [11], treatment solutions for motor disfunctions [12], a biofeedback wearable device for movement rehabilitation [13], the assessment of accuracy in prediction models for augmented biofeedback training in precision shooting [14], among different types of Brain Computer Interfaces (BCI’s), there are none for control and administration of the whole biofeedback and neurofeedback procedures.

Biofeedback (BFB) is particularly relevant in the study of control functions in biological systems. Feedback Loop (FL) has been clearly stablished [15] as the natural process for self-regulation, homeostasis and as a basic element in life support. The information a system is receiving about its interactions with other systems the environment and its current internal state is a key element for future actions to be organized as involuntary or voluntary reactions among other processes and biological functions during existence. In theoretical and experimental approaches to the study of FL processes, contributions of the Theory of Control [16, 17] opened a wide spectrum of research supporting the conclusion that FL processes should be considered as a crucial element for health and self-preservation in biological systems.

In this general context basic, applied, and clinical research in BFB began to grow after two mayor contributions took place in the second half of the last century, both based on the earlier studies of interoception as a specific sensory function [18], with a strong link with behavior [19]. Study of interoception became a milestone to the scientific context in which the first key experimental and clinical contributions of BFB emerged. The first one in the research of abnormal muscular contraction and coordination after neural lesion and how these functions could be restored using electromyographic information coming from the affected muscles and delivered to the patient by other sensory modalities. The objective was to provide the missing information from the neuromuscular spindle, element in the muscle that holds the FL process and was affeccted by the neural lesion. The flow of information to the brain was interrupted impeding the detection of the small potentials remaining and the machine could detect [20]. After a number of sessions using the machine, patients were able to control the affected muscles, feel its contractions, recover the function and the machine was no longer needed. These findings are now considered as first contributions of biofeedback applied research from where today’s Peripheral Biofeedback (PB) procedures were born.

The second contribution arose in a different scenario, one of the most important laboratories of sleep neurophysiology in 1962. A researcher noticed alpha waves (8–12 Hz) distribution was interrupted after participants in sleep studies closed their eyes during EEG recordings preparation process. Happening frequently, even participants were with their eyes closed and awake the natural condition for the regular distribution of alpha waves in healthy human brain. Wondering if this phenomenon could be related to subjective experiences, cognitive processes or consciousness states taking place in that moment [21], adapted methodology developed for neuromuscular rehabilitation presuming mental activity will be different between the two EEG states (alpha activity interrupted or not). Designed an experimental setting to deliver information to participants about the interruptions in its own alfa activity, using an analog auditory tone variations with changes in volume analog to voltage variations in alpha activity, using an arbitrary score to inform participants about their performance. He was developing the first brain waves biofeedback procedure years later called Neurofeedback [22, 23]. When the initial NFB works were published, contradicted reports regarding its replicability arose. First replication of alpha (8–12 Hz) biofeedback study result with contradictory findings [24] and the conclusions of the original author were that his study was not reproduced in the same conditions [25, 26]. Since then, variability and replicability issues in NFB studies have always been present.

With Electromyographic (EMG) biofeedback procedures, used to restore the muscular function loss, medical rehabilitation specialty was enriched, and EMG Biofeedback (EMGB) emerged as a powerful tool for recovery of function in patients suffering from different types of muscular palsies. Procedures were extended using a variety of biological signals as instant information delivered to patients, clients, or experiment participants to establish its control due to learning or conditioning, and later applied for treatment of specific conditions like tension type headache [27], migraine crisis [28] and anxiety and stress [29]. Due to nature of peripheral signals periodicity, stability, spatial and time resolution PB has been used regularly with predictable results and standard norms for assessment and non-invasive treatment of specific medical and neuropsychiatric conditions, relying in the excellent temporal and spacial resolution of the biological signals recorded for this purpose.

Initial NFB procedures out of the research laboratory were difficult to apply. EEG instrumentation was complicated and expensive resources needed for feedback procedures were rare or even inexistent and there was few information about EEG significance in cognitive, consciousness and emotional states. Regular EEG practice was reserved for clinical neurophysiologists to the study and diagnosis of epilepsy [30]. In the middle of 1970’s decade a notable finding, the conditioning of sensorimotor rhythm (smr 13–15 Hz) [31, 32], changed NFB future. Results showed smr conditioning was effective to inhibit spikes and spontaneous seizures in cat [33] and monkey in experimental models of epilepsy [34]. These procedures were quickly adapted and applied to humans showing smr NFB effectiveness for attention deficit and hyperactivity disorder (ADH/D) management and non-invasive treatment [35]. Procedures for specific neurological and neuropsychiatric conditions emerged from the first standardized psychophysiological treatment protocol for Post-Traumatic Stress Disorder (PTSD) [36] initiating a new era around the 1990’s decade. Scientists and clinicians in the field developed devices, software, and intervention procedures for alcoholism [37] depression [38,39,40], traumatic brain injury (TBI) [41], attention deficit disorder (ADD) [42, 43] and ADHD [44] among other protocols, leading to the professional NFB field definition [45]. BFB devices assisted by computers allowed contributions for therapeutic and training procedures and the evolution of clinical practice and research setups, from one channel analog devices to multichannel multimodal computer assisted interfaces. Interventions became more complex arrangements with software capable to delivered feedback, according to clinical findings and normative databases opening a different type of practice with standard procedures based in statistical normative criteria [46, 47]. Develop in instrumentation and software made possible 19 EEG channels recording with online source biofeedback [48] with normative databases, developing brain mapping biofeedback procedure known as QEEG-Biofeedback [49] based in the low resolution tomography (LORETA) [50] environment [51, 52].

NFB expanded over the years, but replication of therapeutic findings and results frequently has been controversial, the so-called standardized treatment or training procedures have been subject to variability in individual conditions, specialist’s decisions, or due to software preinstalled functions in the diversity of the today known as commercial NFB devices. Variability in the clinical and research results have made difficult the path for the field, nevertheless today there’s a big number of professionals in the area all over the world, a substantial number of contributions published yearly and a growing interest in designing and developing more precise and reliable software interfaces.

NFB principle is to enhance through learning or conditioning the patient-trainee capability to “inhibit” specific EEG bands to induce the “predominance” of one in specific. This basic process was developed in the intent to replicate the natural organization of brain waves in health and specific consciousness states. EEG bands relations based in the power values were obtained from the clinical analog EEG recordings after simple statistical analysis. The purpose has been to achieve the resemblance of the general characteristics of normal or wellbeing EEG. This procedures until today frequently find obstacles due to the natural variability, the low spatial resolution of the EEG and the different standards in the fabrication of the commercial NFB devices [53].

The problem addressed in this chapter arises from the concern that after years of development in computational models and tools for the study and analysis of biological signals and the creation and use of ML and DL applications based in EEG recordings, none have reached regular NFB practice, nor the regular production of ML or DL based neurofeedback devices. The aim is to address the constant issue of variability in regular neurofeedback practice and the traditional paths taken to minimize its effects. The line of work discussed in this chapter is oriented to develop DL solutions capable to take care of the whole NFB process, with an architecture capable to substitute current devices and procedures preserving the basic noninvasive intervention principle.

12.2 Current Biofeedback and Neurofeedback Devices and Practice

EEG high temporal resolution property characterized NFB practice for years, beginning with the use of one scalp electrode hookups for ADHD management [47] and cephalic bipolar positions for depression [54]. Difficulties imposed to the traditional methods of analysis arise from EEG low spatial resolution that becomes evident as more channels are used in the recordings and that has always affected NFB research and practice initiated with the adaptation of devices engineered and built for a different purpose and practice [55]. At the time EEG devices were built to be used under specific conditions: restriction of movement, avoiding speech, laying with the eyes closed and were conducted inside a faraday chamber to avoid electrical and magnetic interference. Routine clinical EEG studies were conducted in such conditions and with two standard methods: hyperventilation and photo stimulation used for activation of the EEG to detect spontaneous epileptic activity [56]. Initial neurofeedback studies were instrumented using these types of devices and developing or adapting other instruments to perform approximate measures of the frequencies of interest. Feedback was delivered by auditive, or photo stimulators built for other type of studies, frequently applied manually and signals quantification in relation to feedback events were also taken manually. In such scenarios it was expected the recording contamination with many types and classes of artifacts. Consistent results began to appear encouraging professionals in the field to continue developing and standardizing procedures and techniques for conducting more studies. Devices built specially for these procedures made practice became more consistent, results replicable and due to research results with medical, neurological, and neuropsychiatric conditions clinical field finally emerged. NFB devices evolution can be synthetized as a journey from one channel analog stand-alone systems to multichannel multimodal (EEG and peripheral signals) computer assisted interfaces [57, 58]. NFB conditions requiring participants or patients to be seated with eyes opened, and not into a faraday chamber, lead to design procedures to reduce interference and artifacts. It must be recognized the hard work of the first professionals in the field for standardization of instrumentation, skin preparation techniques, basic room recordings characteristics design, adaptation and standardization of regular EEG techniques and procedures and the design of specific assessment and treatment intervention procedures that structured the specialty and its regulation by professional associations stablishing standards for training specialists and practitioners [59, 60].

Today’s commercial NFB devices are built based in those initial procedures complying with federal agencies regulations and based in the same general principles with some research done to validate its reliability [61]. Many are manufactured with materials and components requiring less skin preparation and recording skills, relying in the structure of its software designed with basic elements to deliver feedback according to built-in protocols and applications. NFB software since the 1990’s era is built into two different classes. One includes the closed systems with software with specific sets of prebuilt applications for specific training purposes and treatment procedures, users have to follow specific guides, montages, derivations and specific band configurations. The other class includes the open systems in which the user has more options to configure EEG and peripheral (ECG, EMG) signals acquisition and feedback, selecting different μV threshold settings, using monopolar or bipolar hookups with two or more recording channels to apply the same principle to deliver feedback procedures. Measures of μVs average values after gross separation of EEG frequency bands are showed in the screen every 3 seconds and treatment interventions rely in determined number of training hours in which the results resembling normal EEG are supposed to appear be stablished as a new normal EEG state expected to evolve during time promoting healthy neurological and neuropsychiatric states [62].

Occasionally some systems include impedance meter displays, more refined online impedance measures with standards indicating safe or poor recording conditions. Denoising is based in gross band filters conducted by differential amplifiers. The software is designed for a gross frequency decomposition and online management of the amplitude average and power measures [63]. Biological artifacts like ECG or eyeblinks are frequently ignored relying in basic and questionable principles like the derivations used in a given treatment intervention [64]. Off-line analysis is performed when the software is built with tools to export or convert files to common formats [65, 66] frequently, specific file formats are used, leaving the option to analyze data with built-in report features, with gross averages, fixed ratio comparisons and the same gross frequency decomposition used during the treatment session. These features have created a state where the NFB practice has been conducted during the last 30 years known as traditional neurofeedback (TN).

QEEG-Biofeedback based on the international 10/20 system [67, 68], is used by specialists to deliver feedback procedures using source localization [69] and inverse solution [70,71,72] principles, with normative databases as guidelines for more elaborated NFB arrangements. Interventions are conducted using more channels, z-scores norms of specific EEG frequencies and its relations, source localization procedures, and -as it is claimed by its creators and regular users-, online feedback of the brain functional connectivity with estimation of the cerebellar electrophysiological activity using only the 19 channels of the traditional 10/20 system [69, 73]. These procedures are not known and used by regular NFB practitioners nor common in the training for regular practice. Some EEG devices used for this specialty are built with clinical degree, safer and more precise, manufactured according to international regulations for clinical EEG practice, engineered with better quality and performance capabilities and some are manufactured by the same fabricants of the TN devices [74] in general do not match the standards of the EEG research grade instruments [75]. General principles for its use are the same that those in the TN and a lot must be done to reduce the effects of the sources of variability.

At the same time the reborn of the EEG has been taking place [76], academic software for EEG analysis have made enormous advances [77,78,79] and computational neuroscience and neuroinformatics are prolific fields for the study and understanding of brain electrophysiology.

12.3 Deep Learning Models for Electroencephalography Analysis

EEG signals have good temporal resolution the clinical work is based in this property and in the band frequency graphic characteristics distinguishing “graphic elements” related to specific disfunctions or illnesses from normal EEG. Most of the time specialists work is based in two parameters: frequency and morphology with a minimal of spacial resolution. EEG practice requires advanced skills, lots of training and supervision, is time consuming and frequently offers conditions facilitating human error. Spatial resolution is poor due to the obstacles that electrical signals generated in the cerebral cortex face in its propagation to the scalp facing different type of tissues with different properties causing that original measures in millivolts (mV) reach the scalp in values within the microvolts (μV) range. It was assumed the sources of EEG signals were found beneath of each recording electrode, changes in technology and recordings techniques questioned this assumption opening the field for source localization based in the inverse solution model [80,81,82].

ML and DL solutions for EEG analysis began to appear since 2010 with communications for epilepsy analysis [83, 84] with a substantial number of studies of DL applications in EEG analysis in research and clinic.

Being raw EEG the basic element in NFB, it must be considered as the source in which DL models have to be applied. Contributions using DL models for end-to-end EEG analysis are encouraging. It was found the prediction of gender from brain rhythms using convolutional neural networks (CNN) for decoding and classification the EEG raw signal [85] showing CNNs potential to extract and classify very specific EEG “hidden” features. In a replication of this study designed to test CNN’s precision in classification using the same data, it was found the model performs better with raw data than with spectral images [86]. These findings support the regular use of DL in neurofeedback, based in the fact that in both cases results were obtain from raw EEG data and the best performance was obtained with minimally processed raw data, basic conditions in NFB regular practice. Peculiarities of NFB settings suggest DL models should be applied as an end-to-end process with the raw data, performing online feature extraction, pre-classification and classification, filtering, pre-processing and processing, before the feedback process takes place. DL models used for offline EEG analysis, and some used in more complex scenarios with online recordings in invasive BCI’s offer a basic platform for DL applications in NFB. An element in our current work is the use of CNNs in the EEG amplifiers processor’s microcode to speed the process (Fig. 12.1). DL solutions have been used in EEG analysis, for signals classification [87, 88] online classification in BCI’s with 84% of accuracy [89], and offline analysis in sleep scoring [90], epilepsy [91], and interictal monitoring [92] searching for accuracy in assessment and diagnosis [93]. A line of work for improving the processing tools has contributions with pipelines including feature learning and extraction [94], signal cleaning and denoising [95], artifact detection [96] classification and elimination [97], generation of data for developing hardware, simulations and DL solutions testing and development [98], and data handling models of EEG signal with lines of research in recordings generation [99] and augmentation [100].

Fig. 12.1
An illustration of a C N N model includes a facial figure pointing to layers labeled A to network model B to layers C to a rightward arrow D.

Schematic overview of a NFB device processor with pretrained CNNs in the microcode. (a). Raw EEG recording samples. (b). NFB device processor with CNNs in microcode for online EEG preprocessing. (c). EEG samples selected for feedback. (d). To computer. (Source: Prof. Jorge J. Palacios-Venegas)

Basic DL research in EEG analysis constitutes and strong line of research in BCI’s develop [101], and cognitive and affective processes research [102]. From 2010 to 2018 a classification of the DL approaches to EEG analysis found lines of work that can be classified identifying: BCI’s develop and testing [103], generation of data [100], and improvement of processing tools [104]. In this field DL strategies have generated information supporting fundamentals for its regular use in NFB, suggesting DL models could be the basic tools for neurofeedback research and practice since it has been successfully used in most of the stages of EEG analysis [105]. DL applications for denoising, artefact elimination, feature extraction and classification are mainly used in offline analysis [4, 106] and frequently used with BCI’s in which analysis and decomposition methods are applied from raw data performing average, average adjusted, normalized, mean adjusted and spectral data analysis based in different methods: fast Fourier transform (FFT), power spectral density (PSD) and spectrogram with statistical analysis of signal parametric values (frequency and voltage) and very specific analysis like wavelet decomposition [107] all in an increasing number of studies in motor imagery [108. 109, 110], and emotion recognition [111,112,113,114] processes.

The efficacy of DL models under such specific conditions supports its regular use with online EEG raw data processing in NFB, in this area of application it must be noted that DL approaches are built with a variety of architectures CNNs [115,116,117], fully connected (FC) [118], long short-term memory (LSTM) [119, 120], auto-encoders (AE) [121], recurrent neural networks (RNN) [122, 123], support vector machines (SVM) [122], and generative adversarial networks (GAN) [123, 124]. All used successfully in EEG analysis in different conditions from resting-state task-negative and task-positive, emotion recognition tasks [113, 125], event related potential detection [127], motor functions induced from imagery [108, 128], and neurological and neuropsychiatric conditions [129, 130]. Prevalent DL architectures are CNNs with structures up to 30 layers with residual blocks and recurrent layers commonly with ranges between 2 to 16 or 18 layers [131]. A typical model of a CNN tested for EEG data analysis from end to end is usually built with a total of 21 layers [132]. Most frequently used structures can be synthetized in sets composed by a 2 Dimension Convolutional Layer (Conv2d) a Rectified Linear Unit (ReLU), a Max pooling operation for 2D spatial data (MaxPool2d), and a Dropout, repeating the sequence until the 28th layer followed then by a Flatten and two consecutives Linear layers [85]. EEG data are structured as 2D matrices representing time and channels, with real values of the negative and positive fluctuations of brain waves. These are the type of data to feed CNNs, Deep Belief Networks (DBN) and Recurrent Neural Networks (RNN) all prevalent in DL EEG processing and analysis [83], showing in some cases accuracies between 81% [133] to 89% [134] combined with analysis based in hybrid Neural Networks (NN) architectures combining CNNs and RNNs, RNNs and LSTM or DBN and 3 restricted Boltzmann machine (RBM) with one dense layer [135, 136]. DL neural, decoding and classification algorithms are the most advanced and precise methods used for these purposes, due to the success obtained in most of the cases [137] are becoming a frequent part of the routine pipeline analysis [138] along with a diversity of NNs, feed forward networks (FFN), CNNs and RNNs are also the most common due to the accuracy obtained in different studies [139]. There are three types of pipelines for EEG data analysis, usually the first composed by the preprocessing methods for cleaning the data and isolate the signals from those in the interference and artifacts spectrum, the second centered in feature extraction process, for decomposition analysis in time, frequency, time-frequency dimensions [140], and used for specific procedures in the spatial domain [141]. Performance of NNs discriminating biological characteristics like gender or individuals, identifying biometric properties of EEG [4], suggests DL models are sensitive to specific and distinctive features in EEG signal and that this sensibility could be extended to most of its regular uses, identifying new ones and implying the future design and use of more complex architectures based in NNs with more layers (beyond 30) designed specifically for every stage in the EEG data analysis and online processing. DL classification and feature extraction from EEG is applied with accuracy in different conditions where EEG was activated with cognitive, emotional, imagery and motor tasks for detection of clinical EEG key components in epilepsy, distinctive elements identification in neuropsychiatric conditions, neurologic disabilities and design and testing of EEG-based authentication technology [142]. Consistency of DL models accuracy obtained in a variety of studies from different conditions, procedures, and methodologies is a promising scenario to develop applications in NFB, based in stability in results using Artificial Neural Networks (ANNs) in a variety of conditions with a variety of procedures [143, 144].

From BCI’s research there are interesting proposals for non-invasive applications [146,147,148,149,149], ML and DL algorithms have proved its best performance with EEG data processing and classification tasks obtained under conditions very similar of those in NFB regular practice, raw signals online analysis, several number of trials and sessions, constant audiovisual stimulation, long duration of the recording sessions, complex cognitive and motor tasks, noise and outliers, features with high dimensionality when converted as vectors and with amounts of information distributed in relatively short periods of time. Non-stationary properties of signals often increased in conditions that are task-related or caused by individual’s reactions, traits, symptoms, or sequelae [149]. The amount of information distributed in time offers possibilities for analysis of concatenated features coming from different time segments and the combination of performing different classifications using dynamic procedures for feature extraction with immediate results used for communication with machines, the environment or the individual itself in NFB setups with processes performed using classification algorithms like generative, static, stable, and regularized. In this type of pipeline, classifiers are used for linear discriminant analysis (LDA) and data separation process prior to classification [151] and SVMs are applied for classes identification [152]. NNs have proved reliability in online EEG raw recording analysis and classification tasks, being the most used: Multi-Layer Perception (MLP) [153], Learning Vector Quantization (LVQ) [154], algorithm Fuzzy Logic, Adaptive Resonance Theory (ARTMAP), Finite Impulse Response (FIR), Time-Delay (TD), Gamma Dynamic Neural Networks (GDNN) [155], Radial Basis Function (RBF) [156], Bayesian Logistic Regression (BLR) [157], Adaptive Logic Network (AL) [158], and Probability Estimating Guarded Neural Classifier (PeGNC) [159]. Research in speech decoding from raw electrocorticographic (EcoG) online recordings with DL models, in a patient suffering from anarthria, reported the accuracy of the DL architecture called natural language performing without errors in an 80 to 150 trials sequence, using a display for communication [150].

12.4 Deep Learning Assisted Biofeedback (DLAB)

Our model is based in years of experience in research and clinical practice with traditional PB, NFB and QEEG-Biofeedback devices designed for all the stages in NFB process. Is built including previous contributions in the field, gathers the most relevant DL solutions used in biomedical signals analysis and processing and incorporates those designed specifically for NFB process. Is structured of a group of independent NN’s running simultaneously and in sequence. Figure 12.2 shows the general diagram with model components. Named as Brain Computer Interface for Biofeedback (BCIB) and controlled by the Deep Learning Assisted Biofeedback Platform (DLABP) is a hybrid NNs design built to carry on with specific processing tasks designed to reduce variability by maintaining stability in the feedback process, working in task positive setups with individuals suffering from different type of conditions or sequelae and considering artifacts should be expected from different sources that can’t be controlled. Our DL platform is conceived with the objective to obtain as final result a stable EEG recording during the NFB session. DLAB hybrid CNNs are built to control EEG stability correcting perturbances from environmental conditions, technical and instrumentation procedures, natural perturbances (fatigue, sleep, drowsiness, eye blinking) and performance -task positive- perturbances (movements, speech, emotional expressions, motor and movement sequelae).

Fig. 12.2
A chart includes the interconnected components of the default database and the cloud database, like E E G amplifier, P P net, S e I net, control net, temporal database, and so on.

Schematic overview of the DLAB model. (Source: Prof. Jorge J. Palacios-Venegas)

Model is based in a constant online database consultation in the cloud, or to a default basic database in the system, performing processes controlled by CNNs built to extract, features from databases and current recordings to select and “target” segments suitable to feedback. A set of NNs is designed to supervise the targeted segments performance during the feedback process with specific denoising functions identifying, classifying and removing artifacts with two different types of outputs corrected and not successfully cleaned. The next NN performs uncleaned segments quantification if results are above 5% feedback is interrupted until recording perturbations are absent. NNs for feedback delivery and administration control stability in targeted segments for feedback based on a predictive process for natural perturbances anticipation. Output of this NN is to interrupt the feedback action until perturbances are over. Three more NNs elements are built to independently measure and assess segments performance during the feedback process, classifying them by stability and types of deviations, the output will feed the group of NNs for quantification, assessment and selection functions, built to control the stability of the feedback process. Figure 12.3 is the schematic representation of the DLABP described in the following pages.

Fig. 12.3
A chart includes the interconnected components of the default database and in the cloud database, like E E G amplifier, pre selected signals, targeted signals for feedback, a temporal database, a system database, and so on.

Schematic overview of the DLABP. (Source: Prof. Jorge J. Palacios-Venegas)

12.4.1 PP-net: EEG Online Preprocessing

PP.net (Fig. 12.3a) receives online raw EEG signals matrices input. Performs denoising, band pass filtering, artifacts rejection, identifies and reject bad channels and segments, performs independent component analysis (ICA) and classification (ICA labeling), frequency decomposition and classification functions for EEG spectrum definition including High Frequency Oscillations (HFOs). Table 12.1 contains the complete frequency bands selected for decomposition. Output are two sets of files one to be ignored (EEGI) and one selected for the feedback procedure organized in 5 seconds segments groups, identified as pre-selected signals. PP-net general structure is convolution layers (CL) for denoising, subsampling, band-pass filtering, CL for artifacts rejection, subsampling, CL for ICA, ICA labeling, subsampling, CL for frequency decomposition extraction and classification, flattening, FC layers for bad channels selection and extraction, output: EEGI segments and preselected signals to feed Sel-net (Fig. 12.3b). Results are stored in local database.

Table 12.1 Frequency EEG bands in frequency decomposition. (Source: Prof. Jorge J. Palacios-Venegas)

12.4.2 Sel-net: Classifying “Targeting” Signals for Feedback

Sel-net (Fig. 12.3b) identifies conditions: eyes closed (EC), eyes opened (EO), activity: task negative (TNg), task positive (TP) classifies the neurophysiological markers (NM) according to conditions: anxiety, depression, addiction or neural states: attention, inattention, drowsiness. Extracts and classifies neural markers matching them with correspondent features extracted from databases, targeting them for feedback. This process involves two types of bidirectional databases consultation. Depending on the resources available (machine capabilities, internet speed etc.) a consultation type is to a small basic default database with preprocessed EEG segments classified by gender, age and recording type and for conditions or state. The other type is a constant consultation to the international databases. Output are two types of files one identified for rejection and one targeted for modification through feedback. A temporal database will be stored for Control-net (Fig. 12.3c) consultation during control functions. Sel-net general structure is CL for condition, subsampling, CL for activity, subsampling, CL for matching to databases, CL for NM identification, subsampling, flattening, FC layers for NM classification. Output: predominant NM selected for feedback. Results are stored in the system database.

12.4.3 Control-net: Extracting and Classifying for Feedback

Control-net (Fig. 12.3c) is built of hybrid NNs with CNN, LSTM and recurrent neural network (RNN), to determine the best temporal sequences model, considering NM complex and nonlinear dynamics nature. Is design to activate or not FB-net (Fig. 12.3d) action based in the output obtained after processing. Is used as a predictive process built to control feedback online delivery. Predictions are made for the temporal stability of the targeted NM based in the stability of the correspondent EEG microstates. Stability is assessed in terms of recordings time permanence if predictions output is for 3 secs or more the feedback is allowed. Control-net general structure is CL, maxpooling, memory layers, flatten, FC. Output: stability NM sustentation in order to control FB-net action (Fig. 12.3d). Results are stored in system database.

12.4.4 FB-net: EEG Online Feedback

Feedback process is the output of a decision function controlled at the same time by two simultaneous NNs. Control-net (Fig. 12.3c) and Config-net (Fig. 12.3e). FB-net (Fig. 12.3d) runs a predictive process based on a hybrid CNNs and LSTMs design, built to assess signals stability runs decision processes based in NM current properties changes. Receives Config-net (Fig. 12.3e) output with estimated values of current NM that match feedback criteria. Its output refines rewarding or positive feedback to both the signals and the subject. Is designed to deliver feedback based in the current stability of NM expecting modifications in its properties (improvement in the general percentage of the performance, increment or decrement of μVs, ratios, asymmetry or synchrony). Implies a moment-to-moment stability measure of NM behavior with the last decision to interrupt the feedback. Is in direct responsibility of the FL control and administration. FB-net general structure is CL, maxpooling, memory layers, flatten, FC. Output: activation of locally stored audiovisual resources analogical to the variations in NM current measures simultaneously sent to Assess-net (Fig. 12.3h). Results are stored in local database.

12.4.5 Config-net: Predictive Maintenance and Feedback Modulation

Config-net (Fig. 12.3e) modulates with assessment and predictive functions current state in FB-net (Fig. 12.3d) performance and possible evolution anticipating faults. Receives Asses-net (Fig. 12.3h) and E-net (Fig. 12.3i) output, processing current NM values matching feedback criteria. Tunes de feedback operation, setting thresholds upon relations between performance in expected frequency μVs values and ratios, measuring general performance and difficulty level in terms of success/error rate during the last 30 seconds segments. Config-net structure is CL, maxpooling, memory layers, flatten, FC. Output: current NM values matching feedback criteria. Results are stored in local database.

12.4.6 iClean-net: Cleaning Performance Perturbances

iClean-net (Fig. 12.3f) is a parallel and independent NN. Feed with current targeted signals for feedback matrices built to extract perturbances consequence of performance during the feedback session. Process current measures performing denoising, artifact removing, identifying and classifying outliers and artifacts extraction. Runs predictive functions with bidirectional communication built to maintain stability in the signals during feedback process, maintaining NM stability cleaning them of interference. Its predictive capabilities are designed with functionality to anticipate stability deficiencies lasting more than 3 secs and performing cleaning process to ensure feedback. iClean-net general structure is CL for denoising, subsampling, CL for artifacts rejection, subsampling, CL for identifying and classifying outliers, CL for movements and artifacts extraction, subsampling, flattening, FC layers for bad channels selection and extraction, resulting in a rectified EEG with clean NM. Output: NM cleaned and corrected for feedback and uncleaned segments sent to PN-net (Fig. 12.3g). Results are stored in local database.

12.4.7 PN-net: Feedback Quality Control System and Interactive Database

PN-net (Fig. 12.3g) is a RNN modify from [159] and restructured to control feedback process based in the amount of perturbances generated during the task positive performance that could not be extracted by iClean-net. Receives online classified datasets performs quantification of identified and classified perturbations. Designed to interrupt the feedback process after 3 seconds of uncleaned segments accumulation. PN-net general structure is quantifiers, LSTM, last LSTM hidden state, FC layer, RELU, a smooth approximation to the hard maximum of the vector (SoftMax). Output: to FB-net for interruption of feedback action. Results are stored in the local database.

12.4.8 Assess-net: Feedback Modulation Control Database

Assess-net (Fig. 12.3h) built for feedback monitoring based in the performance curve of near in time sessions. Is an information central unit of general feedback performance. Exceptionally large deviations between predicted and current EEG signals are used as indicators of the near future or immediate performance. Has feedback process predictive, decision making and control capabilities. Is feed with wavelet transform, short time Fourier and spectral parameterization resolved in time (SPRINT) [160] scalogram images generated with databases information with the outcome of current session, has prediction capabilities based in previous and current performance and databases consultation. Controls the feedback intervention matching current session with performance history and resemblance to default and control data. Executes extraction, classification, quantification and qualification of targeted segments once they have received feedback. Its predictive capabilities anticipate segments probability to receive feedback. Predictive functions are used for preventing setbacks in current performance and treatment, predicting setbacks probability and classifying current data by selecting feedback-performance ratio of previous stages to enhance current preventing relapses or setbacks. Output is performance predicted classes and probabilities sent to the E-net (Fig. 12.3i). Assess-net general structure is input layer of three red, green and blue (RGB) channels, CL, pooling layer, flatten, FC, softmax (last three for classification). Results stored in the local database.

12.4.9 E-net

E-net (Fig. 12.3i) is built for EEG entropy assessment, measured in terms of the current stability in comparison with previous stable feedback periods during session(s) with databases consultation. This function is performed with the segments successfully rewarded with feedback action extracting, selecting and classifying them. Output generates the elements constituting EEG internal stability map, estimating coherence, synchrony, symmetry, stability permanence probability in time. Entropy is defined in terms of sample entropy or SampEn [162, 163]. E-net is built to evaluate whole brain activity (not only NFB derivations) during performance along feedback training session and treatment. E-net general structure is based in parallel SVMs with one class output to Config-net (Fig. 12.3e). Results are stored in local database.

12.5 Discussion

Current development in brain waves BFB leads to its overhauling and regular integration to Neurosciences basic and applied research field. NFB procedures need to be updated complementing them with the most recent advances in neuroinformatics and computational neurosciences, in order to take advantage of achievements in these fields that will make professional practice safer and more reliable and will incorporate NFB research as a regular specialty area in Neurosciences. Setbacks to NFB scientific development due to the issues discussed in this chapter could be overcome with the integration of current ML and DL solutions and the ones to be built, for the creation of an Open Source neuroinformatic environment specifically developed for biological signals acquisition and processing as end to end solutions design from online acquisition, preprocessing a processing to feedback intervention and offline analysis. Solution based in research grade 64 and on EEG channels systems including polygraphic recordings. Table 12.2 shows a comparison of some of the ML and DL key state of the art solutions mentioned in the chapter, to be considered in the development of such an Open Source neuroinformatic environment for NFB.

Table 12.2 ML and DL research in Biofeedback and EEG signals analysis. (Source: Prof. Jorge J. Palacios-Venegas)

12.6 Conclusions

Our model is being built with applications for research and practice based in QEEG Biofeedback procedures. Advances and changes in EEG devices and affordability of more powerful computers will make possible to deploy it into a very different systems (recording devices and computers). Ideal solution is from 64 EEG with 5 polygraphic channels and on, with perspectives for addressing challenges in the NFB spatial domain allowing a more precise work, overcoming some of the spacial resolution restrictions of the traditional NFB EEG recordings. Developing a new generation of integral solutions in temporal and spatial domains with NFB process, that could be used with magnetoencephalography (MEG) devices in the emerging field of MEG-Biofeedback (MEG-B). It also must be considered the developing for regular use of the minimally invasive NFB brain computer interfaces (subcutaneous) to be used with autonomy, for a constant neuromodulation with applications to prevalent neurologic and neuropsychiatric conditions: Alzheimer’s, Parkinson’s, Depression, Autistic Spectrum Disorders or Epilepsy. Conditions requiring constant attention. The aim of this line of work is to develop a less vulnerable, precise and diverse generation of neurofeedback and neuromodulation systems based in Deep Learning solutions.