!531A2!DB353AC4!AB!C25D!

with the corresponding vector of weights:

$$(1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 3)$$

#### *2.3. VSST Data Analysis Method*

We are going to formulate the VSST problem in terms of a pairwise sequence alignment, where both the target scan-path and the obtained scan-path are strings.

Let *T* = *t*1 ... *tn* be any string of length *n* over the alphabet A = {1, 2, 3, 4, 5, *A*, *B*, *C*, *D*, *E*, !}, and let *P* = 1*A*2*B*3*C*4*D*5*E*. Given *T* and *P*, we look for the matches of *P* in *T*, that is the occurrences of symbols of *P* in *T*. Regions of identity (matches) can be visualized by the so-called dot-plot. A dot-plot is a 10 × *n* binary matrix *M* such that the entry *mij* = 1 if and only if *pi* = *tj*, otherwise *mij* = 0. Some toy examples are shown in Figure 3 where the identity is visualized by a dot.

**Figure 3.** Dot-plots for the toy-sequences: (**a**) T = 1A2B3C4D5E; (**b**) T = E1!A2B3CA4D54E and (**c**) T = 4C1BA2!3C4E5DA.

It is easy to see that "diagonals" of dots correspond to consecutive matches of *P* in *T*. This can be formalized as follows. A substring of *T* is a finite sequence of consecutive symbols of *T*, while in a subsequence symbols are not necessarily consecutive. Thus, *P* is a subsequence of *T* if there exist indices *i*1 < ... < *im* such that *p*1 = *ti*1 , *p*2 = *ti*2 , *pm* = *tim* and *T* = *ti*1*ti*1+<sup>1</sup> ... *tim* is the substring of *T* containing *P*.

Let us define the VSST problem as an approximate string matching problem. The approximate string matching problem looks for those substrings of the text *T* that can be transformed into pattern *P* with at most *h* edit operations: a deletion of a symbol *x* of *T* changes the substring *uxv* into *uv*; an insertion of a symbol *x* changes the substring *uv* of *T* into *uxv*; a substitution of a symbol *x* of *T* with a symbol *y* changes the substring *uxv* into *uyv*. When deletion is the only edit operation allowed and we choose *h* = *k* − *m*, the problem is equivalent to finding all substrings of T of length at most *k* that contain *P* of length *m* as a subsequence.

In the VSST problem we search for the first occurrence of *P* in *T*, i.e., we find the substring of *T* starting in the leftmost symbol in *T* containing *P* as a subsequence. This can be done in linear time in the size *n* of *T* with the naïve algorithm.

#### *2.4. The Score Scheme*

Let *T* = *t*1 ... *tk* be the substring of *T* containing *P*. Next step consists of scoring the approximate matching between *T* and *P*. Actually, *h* = *k* − 10 provides a first evaluation of the distance between *T* and *P* since they differ by *h* symbols. Note that this corresponds to defining a scoring system that assigns value 1 to each deletion and sums up each value. However, this measure is oversimple to provide a meaningful evaluation, and moreover we prefer to measure the complementary information, to calculate a "similarity score" between *T* and *P*. Indeed our goal is to assign a final score assessing the performance of the patient in the VSS test. The first step in the definition of the scoring function is to assign a positive value (a reward) to each match, i.e., to each occurrence of a symbol of *P* in *T*. On the contrary, each deletion of symbols of *T* must be assigned a negative value (a penalty). We decided to weakly penalize a deletion of the symbol ! with respect to the deletion of any other symbol, since we consider a fixation of the background as an intermediate pause in the process, but not a true selection of an ROI. We refer to these three values as *penalty scale constants*.

In addition, in the latter case (deletion of a symbol not ! in *T*), we compute the distance of the centroid of the ROI corresponding to the deleted symbol to the centroid of the ROI of the next expected symbol of *P*, to take the spatial relation between the two ROIs. The set of the distances for each pair, normalized by the maximum distance, is then collected in a *distance matrix* (Figure 4).


**Figure 4.** Distance matrix.

Another factor included in the score is the duration of the fixation. We store the information in a parallel array as explained in Section 2.2.2. We assume that the fixation duration is associated to hesitation in the VSST. Since duration corresponds to consecutive repetitions of any symbol, we define a function decreasing in the number of repetitions for scoring the match and increasing in the number of repetitions for scoring the deletion. We refer to it as the *duration function*.

Finally, since the fixations outside the ROIs may be part of the exploration strategy, we compute the frequency of each symbol in the prefix ending there, to amplify the penalty: the frequency corresponds to the number of times that the symbol has been already fixed in the exploration so that it reflects the number of times needed to learn its position.

To summarize, the final score of *T* is the sum of the contributions to the score for each symbol in *T* where each score is obtained by the product of the following factors: the penalty scale constant *v*, the duration function *f* , and, in case of deletion of a symbol non !, an item of the distance matrix, *dist*, and the frequency *f req* of the symbol. The computation of the score is sketched in Algorithm 1.

#### **Algorithm 1** Similarity score evaluation

**Require:** *T*, *w*, *align*, *v*, *P*, *f*(*w*) **Ensure:** *score j* ← 0 index for P *i* ← 0 index for T' *score* ← 0 *f req*(*k*) ← 0 ∀*k in P* **while** *j* = *length*(*P*) *AND i* = *length*(*T*) **do if** *i* = *align*(*j*) **then** match *p*\_*score* ← *v*(0) · *f*(*w*(*i*)) *f req*(*P*(*j*)) ← *f req*(*P*(*j*)) + 1 *j* ← *j* + 1 **else if** *T*(*i*) =! **then** deletion *p*\_*score* ← −*<sup>v</sup>*(1) · [1.1 − *f*(*w*(*i*))] **else** *f req*(*T*(*i*)) ← *f req*(*T*(*i*)) + 1 *p*\_*score* ← −*<sup>v</sup>*(2) · *f req*(*T*(*i*)) · *dist*(*T*(*i*), *P*(*j*)) · [1.1 − *f*(*w*(*i*))] **end if** *score* ← *score* + *p*\_*score i* ← *i* + 1 **endwhile**

We remark that this algorithm uses three vectors: the substring *T*, the vector *w* of the weights of size *k* and a vector *align* of size *m* = 10, which stores the indices of the items of *P* such that *align*(*j*) = *i* iff *ti* = *pj*, else *align*(*j*) = −1. The algorithm scans *T* based on the index *i* and *P* based on *j*. Initially *i* = *j* = 0. Then, it checks if *i* is equal to *align*(*j*): if true, it scores the match (*ti* is equal to *pj*) and both indices are increased, otherwise it scores the deletion of *ti* and then increases *i*. In case of deletion, it checks if *ti* is equal to ! and, consequently, computes the appropriate score. Each access to the vectors takes *O*(1) and the algorithm scans the whole vector *T* so that it runs in *O*(*k*) time.

#### **3. Experimental Results**

After the pre-processing phase described in Section 2.2.2, the data consist of strings with their weights divided into three classes, depending on the individuals performing the test: 46 strings from patients with extrapyramidal syndrome, 284 from patients affected by chronic pain and 46 healthy participants. From now on, we refer to them as the Extrapyramidal (E), the Chronic (C) and the Healthy (H) classes.

For each member of the classes, we computed the score using the algorithm described in Section 2.4. In particular we used *v* = [1, 0.25, 0.5] for the penalty constant vector, and the inverse of the weight of the symbol for the duration function *f* .

Figures 5 and 6 illustrate the dot-plots and the scores computed for a member of each class, respectively. We are going to show that these members are good "representatives" of their classes. At a glance, the dot-plots sugges<sup>t</sup> that the first image corresponds to a performance better than the second, which in turn, looks better than the third.

**Figure 5.** A dot-plot of the strings: (**a**) !5511DAAB3223BBD!53DECCE44ADD55E, member of the Healthy class; (**b**) !!!2CEB1!52!AA55!!24EBBB!!!334!ECC4!B, member of the Chronic class; (**c**) !!!C!3354CCAA!B!A!!E5!!!2!!C!2!5A23122!2!EC!25D!EEE!1353131ACCA!5A!525!2!, member of the Extrapyramidal class.

In the images of Figure 6, we illustrate the score as the bar graph obtained by visualizing each value assigned to each symbol of the sequences as a bar. Let us notice that bars of positive height correspond to the score of matches, whereas bars of negative height correspond to the score of deletions. Matches can be scored with values lower than 1, when repeated; deletions are scored differently depending on repetition, frequency, and distance from the next symbol objective.

**Figure 6.** A bar graph of the scores of the strings: (**a**) !5511DAAB3223BBD!53DECCE44ADD55E, member of the Healthy class; (**b**) !!!2CEB1!52!AA55!!24EBBB!!!334!ECC4!B, member of the Chronic class; (**c**) !!!C!3354CCAA!B!A!!E5!!!2!!C!2!5A23122!2!EC!25D!EEE!1353131ACCA!5A!525!2!, member of the Extrapyramidal class.

Before the analysis, we dropped some outliers for each class, according to the Chebischev Theorem. Setting *γ* = 2, we were sure to retain at least 75% for each class; such a dropping resulted in retaining 43 sequences out of 46 for the Healthy class, 265 out of 284 for the Chronic class and 44 out of 46 for the Extrapyramidal class.

Therefore, we analysed the results using the R language for computing the basic statistics and graphics. A summary divided by the groups is shown in Figure 7, while in Figure 8 we report the box plots.


**Figure 7.** Main statistics for the three classes of patients.

**Figure 8.** Box plots of the score distribution for each class: Healthy (**left**), Chronic (**center**), and Extrapyramidal (**right**).

Based on the obtained results, we can notice that the data seems not to follow a normal distribution, as we can see from Figure 9, at least for two of the three classes (the Healthy class and the Chronic one). Indeed we run the Kolgomorov–Smirnov test for comparison with the normal distribution on each class, obtaining *p*-values, respectively, equal to 6.56388017310154 · <sup>10</sup>−30, 9.711223032427313 · <sup>10</sup>−105, 1.5674138951676932 · 10−12.

**Figure 9.** Q-Q plots for each patients' class: (**a**) Healthy, (**b**) Chronic, and (**c**) Extrapyramidal.

Thus, we used the non-parametric Kruskal–Wallis test by rank which extends the two-sample Wilcoxon test in the situation where there are more than two groups. It turns out that at 0.05 significance level, the medians of the data of the three groups are different. In particular, the *p*-value for the Kruskal–Wallis test is *p*-value = 6.553 · 10−8. In order to know which pairs of groups are significantly different we used the function pairwise.wilcox.test() to calculate pairwise comparisons between group levels with corrections for multiple testing and Bonferroni correction. The results confirm that the pair exhibiting the most significant difference is the Healthy–Extrapyramidal as expected (see Table 1). Indeed, patients with extrapyramidal disease have well known difficulties in visual spatial exploration and executive functions that result in difficulties from the subject to maintain a top-down (human intention) internal representation of the visual scene during task execution. This is reflected in a bad performance in the VSST. Differently, patients in the Chronic class are affected by several kinds of chronic pain syndromes so that they may have different behaviours in performing the task.

Nevertheless, note that, actually, all the pairs have *p*-values less than 0.05 so that they are significantly different.



## **4. Discussion**

In this study, we propose a method for the analysis of gaze in a top-down visual search task and find a score for the VSST performance. The whole pipeline for the process is illustrated in Figure 1. The considered method and score have been validated by comparing the performance of three different subjects' groups. The first group includes 46 patients with extrapyramidal disease, who have well known difficulties in visual spatial exploration and executive functions. The second group is composed of 238 patients suffering from chronic pain syndrome and the third, collecting 46 patients, is a control group.

The identification of a robust method of analysis and the detection of a reliable indicator for the VSST performance, would allow to give a measure of executive functions in a clinical setting for diagnostic and prognostic purposes and eventually in clinical trials. Moreover, scoring the performance of such a VSST may have implications in the rehabilitation of cognitive functions and in general may be used for upgrading mental activity by exercise.

Indeed, cognitive rehabilitation is an effective non–pharmacological treatment that consists of learning compensatory strategies and exploiting residual skills in order to counteract, for instance, cognitive impairments and degenerative diseases. In fact, as for dementia, unfortunately, there is no specific pharmacological treatment, being existing drugs able to counteract the symptoms of the disease, but do not change its course. Consequently, the disease progresses: there is a continuous and constant progressive decline of cognitive functions for the patient, which negatively affects the various daily skills. Instead, changing the course of the disease, "pushing forward" the degenerative progression allows the patient to maintain their autonomy for a longer time and reduces the disinterest, anxiety and depression that degenerative diseases entail. Finally, cognitive rehabilitation is also fundamental for maintaining cognitive functions in efficiency and to combat the consequences of normal aging. Similarly, it is possible to implement intellectual stimulation with a preventive purpose.

The main characteristic of VSST is that it forces the subject to perform a default and logic path using high level cognitive resources. In this task the target of the next fixation changes continuously and, thus, in order to perform an adequate eye movement, each fixation must contain the information on the current target position and the next target location [25]. Previously, Veneri et al. [26] suggested that the re-sampling of the spatial element in such a visual search task requires a ranking of each element of the sequence during fixations. To be effective, this process requires a maximization of the discrimination abilities of the peripheral vision. The comparison of the *expected scan-path* with *the observed scan-path* provides a valuable method to investigate how a task forces the subject to maintain a top-down (human intention) internal representation of the visual scene during task execution. The proposed method has proved to be really effective in distinguishing between healthy people and patients affected by extrapyramidal pathologies, and less sensitive to the differences among the other cohort combinations. Actually, patients with chronic pain syndrome may be affected by very different pathologies—from severe neoplasms to chronic migraines—not all equally disabling from a neurocognitive point of view, which makes this group of patients extremely heterogeneous and difficult to distinguish, for example, from healthy people. Anyway, the main advantage of the proposed VSS test, equipped with the automatic procedure to score its outcomes, lies in the possibility of standardizing the test—making the obtained results repeatable—as well as memorizing them permanently. In this way, for each patient, a historical series of their performance can reliably be collected and analysed, a suitable procedure for evaluating both the course of a disease or the recovery based on a cognitive rehabilitation process.

Some issues concerning the proposed method naturally arise:


designing a more appropriate weight function, which could take into account cognitive features associated with the repetitive behaviour.

## **5. Conclusions**

In this manuscript, we have described a new method for the analysis of the Visual Sequential Search Test, a neurocognitive task commonly used in clinical settings as a diagnostic tool for the evaluation of frontal functions. The VSS test is an eye-tracking version of the Trail Making Test to discover how selection (fixations) guides next exploration (saccades), and how human top-down factors interact with bottom-up saliency. The problem of analysing the VSST outcomes is faced as an episode–matching problem, where an event corresponds to a fixation, and an episode to a scan–path. In this way, a score can be devised able to quantify how much a particular outcome diverges from the expected one. Based on this score, we are able to predict, with a high statistical confidence, if a particular scan-path corresponds to a patient with an extrapyramidal disease or suffering from the chronic pain syndrome or if it describes a "normal" cognitive behaviour. Having a standardized way to evaluate the VSST can help for monitoring the evolution of a disease, for neurological rehabilitation and for intellectual stimulation with a preventive purpose. In particular, the preventive aspect is taking on an increasingly important role, both in terms of the physical and intellectual well–being of the population, and in a more general process of optimizing economic resources for healthcare. We are perfectly aware of the small size of the used dataset. This is a common problem with medical data. Apart from collecting new data, another possible way to overcome this problem could consist in applying data augmentation techniques in order to both balance and enlarge its size. This will be an issue to discuss in future investigations.

**Author Contributions:** Conceptualization, G.A.D., S.B. and M.L.S.; Data curation, S.B.; Formal analysis, G.A.D., S.B. and M.L.S.; Investigation, G.A.D., S.B., M.L.S., A.R. and M.B.; Methodology, G.A.D., S.B., A.R. and M.B.; Project administration, M.B.; Resources, D.F.M.; Software, G.A.D., S.B. and M.L.S.; Supervision, M.L.S., A.R. and M.B.; Validation, A.R.; Visualization, G.A.D., S.B. and M.L.S.; Writing — original draft, G.A.D., S.B., M.L.S., A.R. and M.B. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Patient consent was waived due to the anonymous nature of analyzed data.

**Data Availability Statement:** Not applicable.

**Acknowledgments:** The authors wish to thank RoNeuro Institute, part of the Romanian Foundation for the Study of Nanoneurosciences and Neuroregeneration, Cluj-Napoca, Romania, represented by Dafin Fior Muresanu, for providing the datasets used here for the experiments.

**Conflicts of Interest:** The authors declare no conflict of interest.
