\section{Introduction}

Functional near-infrared spectroscopy is a noninvasive neuroimaging technique that measures the hemodynamic response of the brain based on the change of light absorption in the near-infrared spectrum (700nm--900 nm) \cite{kim2017application}. Light is emitted on the scalp, and crosses the skull, cerebrospinal fluid, and reaches the cerebral cortex, where the hemodynamic chromophore components scatter and absorb the light according to their optical properties \cite{herold2018applications}. The primary hemodynamic components in the blood are mainly oxy-hemoglobin (HbO) and deoxy-hemoglobin (HbR) \cite{Tak_2014_C4}. The modified Beer-Lambert law provides a non-linear relationship that associates fNIRS light intensities with estimates of the local concentration of those components. Based on the neurovascular coupling theory, the information about the oxygenation changes are based on metabolic demands during the brain neural activations \cite{Herrmann_2017_C1}. Therefore, fNIRS can be seen as an important brain activity  monitoring technique that is complementary to other techniques such as electroencephalography which reflects only the electrical activation of the neurons \cite{Pellegrino_2016_C3}.

Optical spectroscopy, as a brain activity imaging method, is relatively new in the neuroscience community. However, the underlying process measured by the latter technique: either metabolic or hemodynamic responses of the brain, has been already widely studied through blood-oxygen-level-dependent signal (BOLD) in functional magnetic resonance imaging (fMRI) over the last three decades \cite{Y_cel_2016_F6}. Even though fMRI studies are clinically accepted as accurate to identify brain physiological activities, the inherent cost of the equipment, the lack of portability, and the low time resolution, put a restriction on the number and type of experiments that can be performed and analyzed. In contrast, fNIRS provides a reliable alternative to collect hemodynamic data with a time resolution that can be up to ten times higher than their fMRI counterpart, with enhanced portability. However, this comes with the cost of a lower spatial resolution \cite{Hennrich_2015_B}.

The research in the field of fNIRS falls into two main families according to their respective focus: clinical and classification oriented studies. Those two research communities aspire to investigate the differences in the signal under the effect of stimuli with their own custom approaches. Clinical studies often focus on quantifying the variations in the recordings when a particular stimulus is applied \cite{herold2018applications}. On the other hand, classification-oriented studies center their goal on the discovery of nonlinear relationships between stimuli and optical signals in order to devise models to predict the provoking stimulus from a new set of signals, with a certain degree of accuracy \cite{Moghimi_2012_D}.

In clinical settings, fNIRS studies rely on the comparison of time-domain properties of the signals. It is assumed that the underlying biological process is a linear time-invariant stimulus-guided process with a noise component, which is modeled as a Gaussian random variable \cite{Tak_2014_C4}. Hence, the signal amplitude difference between a phenomenon of interest and a control case along with its statistical significance can be assessed through the estimation of the first and second statistical noncentral moments. The uncertainty of this difference is usually expressed through confidence intervals or p-values \cite{Herrmann_2017_C1,Pellegrino_2016_C3,Wiggins_2016_C2}.

Clinical procedures are shown to be accurate in revealing specific spatial-temporal patterns in brain activity. It was determined that particular regions of the brain are more \textquotedbl activated\textquotedbl{} than others under specific circumstances or stimuli. It should be perceived that, in this context, \textquotedbl activation\textquotedbl{} denotes a high instantaneous amplitude with respect to the baseline observed mean.

A common method in experimental BOLD-fMRI studies is modeling the fMRI signal with a generalized linear model (GLM) where the design matrix - i.e., the set of regressors of interest - is constructed with a sequence of canonical hemodynamic response functions (HRFs) \cite{Mumford_2015_F1}. HRFs are significant models of time-domain brain metabolic activity, providing a series of measures with psycho-physiological interest: amplitude, delay, and duration of the hemodynamic process \cite{Handwerker_2004_F3}. GLM-HRF in fNIRS data is known to be reliable for detecting differences in the activation patterns in the visual cortex \cite{Huppert_2016, Y_cel_2016_F6}.

For classification-oriented tasks, machine learning methods exhibit high performance in activity prediction due to their ability to explore and discover nonlinear structures in the data. In contrast with other classification fields, recent studies have been inconclusive in determining a predominant algorithm that can outperform all classification tasks when fNIRS is involved. Levels of pain can be detected with support vector machines with 94\% accuracy \cite{Fernandez_Rojas_2019_A}. Differentiation between word generation, motor imagery, and mental arithmetic yielded an accuracy as low as 66\% with a deep neural network \cite{Hennrich_2015_B} while discrimination between visual and auditory stimuli reached an accuracy of 97.8\% with support vector machine (and additional features extracted from EEG) \cite{Putze_2014_C}. In contrast to the nonlinear models, the accomplished accuracy in emotion classification was 71.9\% using linear discriminant analysis (LDA) \cite{Moghimi_2012_D}. Moreover, speech activity identification obtained an accuracy of 74.7\% using generalized canonical correlation analysis \cite{Liu_2018_E}. This diversity of algorithms with a large variability of accuracy coincides with the no free lunch theorem that states that \textquotedbl \emph{no algorithm can be good for any arbitrary prior}\textquotedbl{} information \cite{Adam_2019_NFL}.

Despite the effectiveness of machine learning methods in classification oriented studies, the complexity associated with the interpretability of the nonlinear models, generally more flexible, although limits their use in clinical studies \cite{Fernandez_Rojas_2019_A}. In the latter, the explanation of underlying physiological processes is more valuable \cite{Marrelec_2004_H6}. Mathematical models with enough complexity to provide high predictive performance, but based on interpretable and physiological-supported models, then this gap shall be solved.

In this paper, we propose a parametric method: the hemodynamic decomposition model (HDM), which aims to satisfy the requirements of both types of fNIRS analysis. HDM explains a metabolic signal, such as oxy- or deoxy-hemoglobin, as a sum of a series of independent bases. Each basis function is a simplified version of the canonical hemodynamic response function for sensorimotor activities while keeping a clear theoretical description of the underlying metabolic activity. HDM also provides enough information as a feature input for prediction-oriented purposes showing an exceptional predictive power in machine learning algorithms under different circumstances.

The remainder of this paper is organized into three additional sections: the description of the model and the iterative estimation method (section 2); the analysis of the potential of HDM for machine learning tasks using real fNIRS data (section 3); and our conclusions (section 4.)

\section{Model}
\begin{center}
\begin{figure*}[th]
\begin{centering}
\includegraphics[width=0.95\textwidth]{hrf-canonical-model-glm-example.pdf}
\par\end{centering}
\caption{\label{fig:Simulation-GLM}Subject-level GLM of a hemodynamic data with the canonical HRF. (A) Components of the canonical double-gamma HRF, considering the GLM. (B) Hypothetical triggered set of stimuli $u\left(t\right)$. (C) Hemodynamics modelling, estimating the causes a change, with a convolution operation $u\left(t\right)\ast h\left(t\right)$. (D) Empirical distorted and noised signal $u\left(t\right)\ast h\left(t\right)+\varepsilon\left(t\right)$. These four panels represent the canonical HRF decomposition for sensorimotor activities.}
\end{figure*}
\par\end{center}

Hemodynamic signals, within-subjects, are modeled as linear time-invariant systems using theoretical hemodynamic response functions (HRFs) as a foundation. An HRF is a function that represents the typical oscillation phases in the blood dynamics. The de facto model for hemodynamic data, originally defined for fMRI time series, defines the output signal $y\left(t\right)$ as the convolution of a stimulus function $u\left(t\right)$ and an HRF $h\left(t\right)$ with an additive noise component \cite{Cignetti_2016_H0,Friston_1998_H3}:
\begin{align}
y\left(t\right) & =x\left(t\right)\beta+\varepsilon\left(t\right)\\
x\left(t\right) & =u\left(t\right)\ast h\left(t\right)
\end{align}
where $\ast$ is the convolution operator, $\beta$ is the regression parameter, while $\varepsilon\left(t\right)$ models the noise. Subsequent measurements in BOLD-fMRI signals show correlated noise. Therefore, this behavior is modeled through a first-order autoregressive noise \cite{Seghouane_2015_H8}:
\begin{equation}
~\varepsilon\left(t\right)=\rho\varepsilon\left(t-1\right)+\eta\left(t\right)
\end{equation}
where $\eta\left(t\right)$ is a Gaussian white noise $\eta\left(t\right)\sim\mathcal{N}\left(0,\sigma^{2}\right)$ with a variance $\sigma^{2}$. A simulation of the hemodynamic representation performed by this model is depicted in Figure \ref{fig:Simulation-GLM}b-d.

It is worth mentioning that there is not a unique and general HRF, and in order to guarantee that the GLM's parameters could be estimated from the data, there are three conditions that a HRF must meet: a) to start and end at zero; b) to be smooth, or at least, have continuity in the first and second derivatives \cite{Marrelec_2004_H6}; and c) to be a causal function, i.e., it should only depend on current or previous values \cite{Makni_H7}.

Several types of basis HRFs that fulfill the aforementioned conditions have been proposed which include: Fourier sets, finite impulse response functions, and gamma-based functions \cite{Glover_1999_H2} to mention a few. Among the alternatives, the single- and double-gamma HRFs are the most common in the literature and also integrated in the standard toolboxes \cite{Cignetti_2016_H0}. The two-gamma HRF, also known as the canonical hemodynamic response function, described in \cite{Glover_1999_H2}, models the increasing and decreasing (or undershoot) phases of the metabolic process with two gamma functions:
\begin{align}
h\left(t\right) & =g\left(t;a_{i},\omega_{i},t_{i}\right)-g\left(t;a_{d},\omega_{d},\tau_{d}\right)\\
g\left(t;a,\omega,\tau\right) & =a\left(\frac{t}{\tau}\right)^{\kappa}\exp\left(-\kappa\frac{t-\tau}{t}\right)\label{eq:def-hrf}\\
\kappa & =\left(8\ln2\right)\left(\frac{\tau}{\omega}\right)^{2}
\end{align}
where $g\left(\cdot\right)$ is the gamma function characterized by three parameters: response height $a$, time-to-peak $\tau$, and dispersion or full-width at half-maximum $\omega$ as defined in \cite{penny2011statistical_H5,Yan_2018_H12}. $g\left(a_{i},\omega_{i},t_{i}\right)$ and $g\left(a_{d},\omega_{d},t_{d}\right)$ model the increasing and decreasing, or undershoot, phases of a typical hemodynamics.

A visual description of the six parameters (three per gamma function) of the canonical HRF with the standard values for sensorimotor activities ($a_{i}=1$, $\omega_{i}=5.2$, $\tau_{i}=5.4$, $a_{d}=0.35$, $\omega_{d}=10.8$, $\tau_{d}=7.35$ \cite{Yan_2018_H12}) is shown in Figure \ref{fig:Simulation-GLM}a. It should be denoted that these reference values are not universally accepted; some authors argue that the canonical HRF should be a double-gamma with its peak delay at, approximately, six seconds, undershoot delay of sixteen seconds, and with a peak-undershoot amplitude ratio of six \cite{penny2011statistical_H5}. However, in this paper we rely on those parameter values as in \cite{Glover_1999_H2} and \cite{Yan_2018_H12}.

From the abovementioned model, two fundamental properties should be emphasized: a) the convolution $u\left(t\right)\ast h\left(t\right)$ produces, under certain conditions, a curve that is approximately another gamma-function with a dispersion proportional to the stimulus duration \cite{penny2011statistical_H5,Blahak_2010_G1}, and b) the canonical HRF can be considered as an extension of a single gamma function model with a negative single gamma function explaining the undershoot phase. When there is no apparent undershoot in the observations, the single gamma model can also provide a good fit \cite{Boynton_1996_H10,Yan_2018_H12}. Thus, it is reasonable to conceive that the combination of GLM and HRF (GLM+HRF) can be reformulated as a concatenation of individual successive gamma functions with duration proportional to the span of each impulse, and with positive or negative amplitudes.

Relying on the same principles, we propose a hemodynamic decomposition model (HDM) where the observed hemodynamic signals (sampled every $T_{h}$ seconds) are represented as a sequence of a finite and unknown $K$ number of triggered responses $h_{k}\left(t\right)$:
\begin{align}
y\left(t\right) & =\sum_{k=1}^{K}h_{k}\left(t\right)+\varepsilon\left(t\right)\label{eq:model}\\
h_{k}\left(t\right) & =a_{k}g_{0}\left(\frac{t-\tau_{k}+\tau_{0}}{\nicefrac{\omega_{k}}{\omega_{0}}}\right)
\end{align}
where $y\left(t\right)$ is the autocorrelation effect, $h_{k}\left(t\right)$ is the triggered responses, $\varepsilon\left(t\right)$ is the random fluctuations, and $g_{0}\left(t\right)$ is a the positive gamma cycle of a sensorimotor standard HRF, for instance, $g_{0}\left(t\right)=g\left(t;a_{0}=1,\omega_{0}=5.2,\tau_{0}=5.4\right)$. Furthermore, the random fluctuations (noise) are Gaussian-distributed ($\epsilon\left(t\right)\sim\mathcal{N}\left(0,\sigma_{\varepsilon}^{2}\right)$): $\varepsilon\left(t\right)=\theta_{\varepsilon}y\left(t-T_{h}\right)+\epsilon\left(t\right)$.

HDM models the measured signal as a sum of shifted, expanded, and scaled kernel waves. Semantically, this representation is not in conflict with  the foundational claims of the GLM+HRF model. But, HDM enables representing those circumstances when the stimuli do not generate any noticeable reaction or when the response appears before or after the stimulus.

In order to describe the model in a formal framework, let us define a set $\Omega=\left\{ \left(a_{k},\omega_{k},\tau_{k}\right)\right\} _{k=1}^{K}$ that represents the three main parameters of an HRF: amplitude, duration, and starting time, respectively. The conditional log-likelihood of $N+1$ sampled points from $y\left(NT_{h}\right)$, $y\left(T_{h}\right),\ldots,y\left(\left(N-1\right)T_{h}\right)$ $\theta_{\varepsilon}$, (Equation \eqref{eq:model}) and with respect to a known initial point $y_{0}$ and $\sigma_{\varepsilon}^{2}$ is given as follows
\begin{align}
& \log\mathcal{L}\left(\Omega,\theta_{\varepsilon},\sigma_{\varepsilon}^{2}\right) = \nonumber\\
& =\log f_{\Omega,\theta_{\varepsilon},\sigma_{\varepsilon}^{2}, y\left(0\right)=y_{0}}\left(y\left(\left(N-1\right)T_{h}\right),\ldots,y\left(0\cdot T_{h}\right)\right)\nonumber \\
 & =-\frac{N}{2}\log\left(2\pi\right)-\frac{N}{2}\log\sigma_{\varepsilon}^{2}-\frac{1}{2\sigma_{\varepsilon}^{2}}\sum_{n=1}^{N}\left(S_n^*\right)^{2},\label{eq:log-likelihood}\\
&S_n^*=\delta_n-\theta_{\varepsilon}y\left(\left(n-1\right)T_{h}\right) \label{eq:log-likelihood-S}\\
&\delta_n=y\left(nT_{h}\right)-\sum_{k=1}^{K}h_{k}\left(nT_{h}\right) \label{eq:log-likelihood-deltaS}
\end{align}
The conditional maximum likelihood estimator $\left(\Omega,\theta_\varepsilon,\sigma^2_\varepsilon\right)$ can be obtained by minimizing $\log\mathcal{L}\left(\Omega,\theta_{\varepsilon},\sigma_{\varepsilon}^{2}\right)$. Details about the numerical optimization for this estimator is given in the next subsection.

\begin{center}
\begin{figure*}[th]
\begin{centering}
\includegraphics[width=0.95\textwidth]{kernel-decomposition-model}
\par\end{centering}
\caption{\label{fig:HDM-Process}Hemodynamic chartflow decomposition process. The input signal is observed (left-hand panel), and the HDM initialized (decomposing the local extrema and restrict search space, centered-top panels) then a nonlinear optimization is conduced seeking the convergence criteria, resulting in signal partitions (right-hand panels).}
\end{figure*}
\par\end{center}

\subsection{Numerical optimization algorithm}
By analogy to a mixture model with an $L_{2}$ distance, the MLE estimators of the model described in Equation \ref{eq:log-likelihood} can have several local optima, and therefore, gradient descent methods are not the most effective numerical techniques to estimate the parameters. First, we expect that a low pass filter will already remove the high-frequency noise during the preprocessing of fNIRS. Therefore, we focus on modeling the low-frequency random fluctuations ($\theta_{\varepsilon}>0$.) Hence,
\begin{align}
\hat{\Omega} &= \arg\min_\Omega \sum_{n=1}^N\left(S_n^*\right)^{2}
=  \arg\min_\Omega\sum_{n=1}^N \left(\delta_n\right)^{2}
\end{align}
where $S_n^*$ and $\delta_n$ are defined as in Equation \ref{eq:log-likelihood-S} and Equation \ref{eq:log-likelihood-deltaS}.

Second, due to the high computational complexity, we consider $\hat{\Omega}$ to be  an accurate approximation whenever the squared Euclidean distance (or squared $L_2$ norm), between the modeled HRFs and the observed discrete signal is less than a radius of convergence $\xi$:
\begin{equation}
\sum_{n=1}^{N}\left(\delta_n\right)^{2}\le\xi
\end{equation}
Third, to ensure a consistent parameter estimation, we introduce a iterative estimation approach (Figure \ref{fig:HDM-Process}) for constructing the parameter search space:
\begin{itemize}
\item Construct $\left\{ \left(t_{i},y_{i}\right)\right\} $ as a set of $M$ local extreme points, i.e., those points such where $\left.\frac{dy}{dt}\right|_{t=t_{i}}=0$.
\item For each time index $t_{i}$, define three sets: $\Omega_{a}=\left[\kappa_{a0}y_{i},y_{i}\right]$, $\Omega_{\omega}=\left[\omega_{\epsilon},\omega_{m}\right]$, $\Omega_{\tau}=\left[\kappa_{\tau0}\tau_{0},\kappa_{\tau1}\tau_{0}\right]$. $\Omega_{\tau}$ describes the potential ranges where the hemodynamic impulse are expected to be produced. According to \cite{penny2011statistical_H5} and \cite{Yan_2018_H12}, the common starting time is located from five to sixteen seconds before an observed peak ($\kappa_{\tau0}=0.8$, $\kappa_{\tau0}=3$). $\Omega_{\omega}$ outlines the feasible choices for the duration. Based on \cite{penny2011statistical_H5} and \cite{Glover_1999_H2}, the maximum observed duration experimentally is slightly higher than seven seconds in sensorimotor stimuli; therefore, we set $\omega_{m}=8$. The lowerbound $\omega_{\epsilon}$ was empirically set to 0.1 seconds in our experiments. Finally, $\Omega_{a}$ denotes the search space of HRF amplitudes. We prioritize those components that explain most of the observed amplitudes. Consequently, we define the upperbound as the observed amplitude $y_{i}$, and the lower limit as a proportion of $y_{i}$. Furthermore, in our analysis we set $\kappa_{a0}=0.8$.
\item For each triplet $\left(\Omega_{a},\Omega_{\omega},\Omega_{\tau}\right)$ related to the time $t_{i}$, we use the Broyden--Fletcher--Goldfarb--Shanno optimization algorithm to optimize the best parameters $\left(a^{*},\omega^{*},\tau^{*}\right)$ that minimize the $L_{2}$ distance between the estimation and the observations in the time interval $\left[t_{i},t_{i}+2\max\left(\Omega_{\tau}\right)\right]$. Due to the waveform of the gamma-function, we submit that the component effect outside the interval will not be significant. The previous constraints not only guarantee finding the best component that locally explains the input signal, but  also reduce the computational time due to a supplementary contraction in the search space.
\item Define $R^{\left(0\right)}=y\left(t\right)$, and let $R^{\left(\ell\right)}$ and $r^{\left(\ell\right)}$ be residuals of the $\ell$-th iteration: $R^{\left(\ell\right)}=R^{\left(\ell-1\right)}-a^{*}g_{0}\left(\frac{t-a^{*}+\tau_{0}}{\nicefrac{a^{*}}{\omega_{0}}}\right)$ and $r^{\left(\ell\right)}$ the residual sum of squares $r^{\left(\ell\right)}=\left|R^{\left(\ell\right)}\right|^{2}$. The previous steps can be repeated until $r^{\left(\ell\right)}$ reaches the threshold error $\xi$ or $L$ iterations.
\item Given the set of estimators $\left\{ \left(a_{i}^{*},\omega_{i}^{*},\tau_{i}^{*}\right)\right\} _{i}$, the autocorrelation parameter $\hat{\theta}_{\varepsilon}$ is obtained using least square estimation:
\noindent\begin{align}
\hat{\theta}_{\varepsilon} & =\arg\min_{\theta_{\varepsilon}}\sum_{n=1}^{N}\left(\delta_n^*-\theta_{\varepsilon}y\left(\left(n-1\right)T_{h}\right)\right)^{2}\\
\delta_n^*&=y\left(nT_{h}\right)-\sum_{k=1}^{K}a_{k}^{*}g_{0}\left(\frac{nT_{h}-\tau_{k}^{*}+\tau_{0}}{\nicefrac{\omega_{k}^{*}}{\omega_{0}}}\right)
\end{align}

\end{itemize}

\section{Experimental analysis}

In this section, we explore the potential of our proposed decomposition technique --HDM--, in the role of the methodological framework combined with the feature extraction method in a machine learning context as it is illustrated in Figure \ref{fig:chart}. We define a classification problem with the goal of predicting the cognitive level related to an activity that a subject is performing based on his hemodynamic signals.

\begin{figure}[t]
\begin{centering}
\includegraphics[width=0.95\columnwidth,height=5cm,keepaspectratio]{simulations-chartflow}
\par\end{centering}
\caption{\label{fig:chart} Visual summary of the experimental framework.}
\end{figure}

\subsection{Dataset}
\begin{figure}[t]
\begin{centering}
\includegraphics[width=0.95\textwidth]{fnirs-definition-and-probe-locations}
\par\end{centering}
\caption{\label{fig:def-and-locations}Principles and measurement settings of fNIRS. (A) Illustration of the the working principle of fNRIS, that is, a Physiological channels used in the analysis. The selected seven fNIRS channels, placed in the frontal cortex, are showed in panels (B) side, (C) front, and (D) top view.}
\end{figure}

The dataset of the experiment comprises oxy- and deoxy-hemoglobin signals estimated from the fNIRS using the modified Beer-Lambert law. For repeatability purposes, a publicly available dataset is being used for our pilot analysis which comes from a series of experiments performed by Shin et al. at the Technische Universit{\"a}t Berlin involving \textquotedbl n-back\textquotedbl{} tasks \cite{Shin_2018_ML2}. Their study was restricted to 29 subjects in the age group of 20-30 years old. We rather focused on one of their experiments: n-back tasks, which are accurate markers of brain workload \cite{Whiteman_2017_ML1}.
The dataset contains a series of sessions, where each session protocol is composed of four steps: a) show a straightforward instruction for 2 seconds; b) request the subject to perform the task (0-, 2-, and 3-back); c) ring a short beep for 250ms; and d) rest for 20 seconds. For further information about the experimental protocol, we refer the reader to \cite{Shin_2018_ML2}. The fNIRS signals in the dataset were sampled at 10Hz on 36 channels. For the purpose of this study, we selected seven channels in the frontal cortex: AF7, AF8, AFF5h, AFF6h, AFp3, AFp4, and AFpz, according to the EEG 10-20 standard layout position, as it is shown in Figure \ref{fig:def-and-locations} \cite{Shin_2018_ML2}.

\subsection{Experimental setting}

Based on the complete dataset provided by Shin et al. \cite{Shin_2018_ML2}, we configured two simulation scenarios to test our method:
\begin{itemize}
\item Scenario A: classification using six channels from the frontal region: AF7, AF8, AFF5, AFF6, AFp3, AFp4 (Figure \ref{fig:def-and-locations}) with data from the \textquotedblleft subject 01.\textquotedblright{} This setting will expose the ability of the hemodynamic decomposition method to provide relevant information in machine learning algorithms as it is known that cognitive load manifests with activations in the frontal cortex \cite{racz2017increased}.
\item Scenario B: workload identification using only the channel AFpz (frontal region slightly over the root of the nose, Figure \ref{fig:def-and-locations}). In contrast with the previous simulation, due to the reduced amount of data used in this setting, this scenario is assessed with data from subjects 01-26. The results of this simulation will assess the capabilities of our method under spatially limited data.
\end{itemize}
To compare the efficiency of our model as a pre-processing technique, we establish two alternative feature sets: raw time-domain signals, and time-frequency features. The time-frequency decomposition (TFD) is based on a filter bank structure (FB): we define five 100th-order finite-impulse-response band-pass filters in the ranges: 0-0.02Hz, 0.02-0.04Hz, 0.06-0.08Hz, and 0.08-0.10Hz. These intervals are known to contain the most relevant information related to hemodynamic processes, and Appriou et al. showed that the TFD-FB provides a prediction accuracy of 67.9\% $\pm$ 8.1\% \cite{Appriou_2018_ML7}.

\begin{figure*}[th]
\begin{centering}
\includegraphics[width=0.95\textwidth]{double-comparison-ml-scores.pdf}
\par\end{centering}
\caption{\label{fig:boxplot-results}Performance of HDM in activity recognition on the two different brain region, adopting six machine-learning algorithms, based on three data pre-processing. Scenario A (top panels): data gathered from the six frontal-cortex channels: AF7, AF8, AFF5, AFF6, AFp3, and AFp4 of subject 01. Scenario B (bottom panels): data collected from subject 01 from only channel AFpz.\protect \\
Six machine-learning algorithms were compared (each panel from the left to the right): 1) SVM; 2) random forest with 50 trees and 3) 500 trees; 4) decision trees (CART) with 6 depth levels and 5) 10 levels; and 6) LDA classifier.\protect \\
The abscissa axis represents the type of input on the algorithms: raw data (RD), bank filter features (BFF), and HDM. In all evaluations, box plots show the second and third quantile of the results using SWTT. Empirical results showed the outperformance of the HDM across almost all classifiers.}
\end{figure*}

For each feature extraction technique, we applied four basic machine algorithms and compare their performance: support vector machines (SVM) \cite{Fernandez_Rojas_2019_A,Putze_2014_C}, random forests (RF) \cite{Erdo_an_2019_ML3,Keshmiri_2017_ML4} classification and regression trees (CART) \cite{Sirpal_2019_ML5}, and linear discriminant analysis (LDA) \cite{Appriou_2018_ML7}. These algorithms were selected, given their proven efficiency to solve other classification tasks were fNIRS was involved. Based on the literature results \cite{Appriou_2018_ML7}, there were no significant differences between the performance of recursive neural networks respect with LDA with features extracted with filter banks. Due to this reason and the lack of longer time series per subject, deep learning routines were not included in this comparison. For further details about the applied algorithms, we refer to \cite{Fernandez_Rojas_2019_A,Keshmiri_2017_ML4,Sirpal_2019_ML5,Appriou_2018_ML7}.

Physiological signals hold substantial information about their time dependency structure. In order to keep this structure in our experimental setting, the validation method consisted of a sliding window train-test (SWTT) \cite{bouktif2019single}: the algorithm predicted the following activities in 2 seconds using the information from the previous 60 seconds. This estimation technique is known for being unbiased with a moderately low variance \cite{kohavi1995study_EST1}.

\subsection{Results}
\begin{figure*}[th]
\begin{center}
\noindent\includegraphics[width=0.95\textwidth]{plot-performance-across-subjects-RF500-seq.pdf}\\%
\noindent\includegraphics[width=0.95\textwidth]{plot-performance-across-subjects-CART10-seq.pdf}
\caption{\label{fig:cross-subjects-boxplot-results}Subject-level performance of HDM in a single-channel activity-recognition in 26 subjects. Three preprocessing methods were compared: 1) raw data (RD), left-hand panels, and bank filter features (BFF), center panels, and 3) HDM, right-hand panels. Two algorithms were applied: A) random forest with 50 trees (top panels); B) Decision trees CART --10-level depth-- (bottom panels). The identifier of the subject from whom data is collected is shown in the x-axis for each plot. Note that HDM provides a higher accuracy with both classification models. }
\end{center}
\end{figure*}

Since the distribution of the four labels  (0-back, 2-back, 3-back, and rest) is balanced across the dataset, the accuracy is a proper metric of the algorithms' performance, and thus it is used to compare the outcomes. We compiled the results of the experimental scenario A (with frontal cortex data) and B (with single-channel signals) from ``subject 01'' in Figure \ref{fig:boxplot-results}.

From the empirical results, there are a few noteworthy observations regarding the performance of the different machine learning algorithms:
\begin{itemize}
\item Random forests showed more success at identifying cognitive load states regardless of the experimental setting. These results are also concordant with the conclusions found in previous studies \cite{Appriou_2018_ML7}.
\item Support vector machines (SVM) did not exhibit the best performance in our experiments. We examine this behavior using the cumulative confusion matrices of Table \ref{tab:confusion-matrix-A} and \ref{tab:confusion-matrix-B}. Even though SVM performs worse than the other algorithms, it can recognize the n-back activities, but it exhibits a high level of uncertainty when differentiating those states from their respective rest periods. However, the level of uncertainty among n-back activities is minimal when using HDM with respect to TFD-FB or raw data.
\item By comparing experiments A and B, it is evident that the performance drops when the input data is restricted to one channel. The only two exceptions are linear discriminant analysis and random forests with the decomposition model HDM. The sensibility of LDA improves by 8.88\% and its precision by 11.1\%. Random forests maintain identical performance across both cases.
\item Decision trees do not exhibit a substantial difference with the SVM alternatives where TFD-FB and raw data are the input features. Nevertheless, they yield attractive accuracy metrics when HDM is utilized: between 73.2\% and 83.8\%. HDM produces a non-linearly mapping of each task into hemodynamic responses, and we hypothesize that decision trees are partially detecting those non-linear boundaries.
\end{itemize}
The results indicate that the increment of the prediction power using HDM is not intrinsically associated with one specific family of ML algorithms. We can argue that {HDM is a proper method to extract relevant features from the fNIRS signals. However, the precision of brain activity detection will rely on the chosen algorithm}. Additionally, the remarkable results of the decision trees in experiment B are promissory for further development of fNIRS activity recognition systems, especially implemented in devices with hardware restrictions or real-time architectures (due to the low time complexity of training CART methods).

\section{Conclusion}

We propose an appealing representation of fNIRS signals using a hemodynamic decomposition model (HDM) that has an intuitive physiological interpretation. It models the observed signal as a sum of independent hemodynamic responses, where each one is based on the canonical HRF, but rescaled in duration and amplitude, and triggered at different instants. Estimating those parameters and the number of HRFs that accurately model the hemodynamic signals is time-exhaustive, nonconvex optimization problem. To cope with this problem, we present an iterative estimation process that maximizes the accuracy of the signal and allows us to control the precision of the representation using only two hyper-parameters: the number of maximum iterations and the convergence ratio.

Due to the data-driven nature of the HDM model, no additional information about the stimuli in the experiment is required. Nevertheless, the method can be combined with registered stimuli as a feature extraction method for machine learning algorithms in prediction/classification tasks. We investigated the case of brain cognition load prediction under a classical experiment setting (n-back). Raw data and time-frequency features were compared with our decomposition model using different classification methods including support vector machines, decision treees and random forests. We conclude that our method has a clear advantage as a feature transformation regardless of the deployed algorithm. HDM yields an improvement in the accuracy by up to 21.59\% and 23.69\% with respect to time-spectral and raw data features, respectively.

\section{Funding}
This work is financially supported by the Research Council of Norway to the Project No. 273599, "Patient-Centric Engineering in Rehabilitation (PACER)". Diego C. Nascimento is partially supported by the Brazilian funding agency "Coordena\c{c}\~{a}o de Aperfei\c{c}oamento de Pessoal de N\'{i}vel Superior" (CAPES).

\bibliographystyle{IEEEtran}