Showing posts with label publication. Show all posts
Showing posts with label publication. Show all posts

Guide for reproducing our BioRxiv Manuscript.

In this post, I would like to provide guidelines on how to reproduce results and figures presented in our recent manuscript in BioRxiv. I will show how to download the raw data, run the analysis routines,  and produce figures that are shown in the paper. The text below is also present in the READ.me section of the associated Matlab toolbox that is published as an open-source in GitHub.

About

With this repository you can reproduce all the analysis and figures presented in our paper:
Fear Generalization as Threat Prediction: Adaptive Changes in Facial Exploration Strategies revealed by Fixation-Pattern Similarity Analysis. Bioarxiv
In this paper, we investigate how humans explore faces and focus how these exploration patterns change when faces are associated with an aversive outcome.

Initial Setup

You can download the data and the associated repositories, including this one from the Open Science Framework here. Add these repositories to your Matlab path.
addpath('/home/onat/Documents/Code/Matlab/FPSA_FearGen/');
addpath('/home/onat/Documents/Code/Matlab/globalfunctions//');
addpath('/home/onat/Desktop/fancycarp');

Examples

Get the list of participants.

The data you downloaded from the OSF contains all recorded participants. However, few had to be excluded for the main analysis. It is important to include all participants as it provide the possibility to reproduce the selection criteria used in the report or test the results with another selection criteria. 'get_subjects' action returns all the selected participants, totalling to 74.
>> FPSA_FearGen('get_subjects')
ans =
  Columns 1 through 45
     1     2     3     4     5     6     7     8     9    10    11    12    14    15    16    17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32    33    35    36    37    39    40    41    42    43    44    45    46    47    48
  Columns 46 through 74
    49    50    51    53    54    56    57    59    60    61    62    63    64    65    66    67    68    69    70    71    72    73    74    77    78    79    80    81    82
>> 

Sanity check 1.

In eye tracking it is usual that few trials are excluded due to blinks or bad calibration. The following code plots the number of trials per condition across the participant pool. The figure shows that almost all the particpants have their trials recorded as expected. This sanity check also shows that few participants have less trials than others.
FPSA_FearGen('get_trialcount',4)
4 above refers to the generalization phase. (2: baseline; 3: conditioning; 4: test phase).

Get the data to workspace using the get_fixmat action.

Fixmat is a compact way of storing large amounts of eye movement recordings in the form of fixation points.
>> fixmat = FPSA_FearGen('get_fixmat')
ans = 
  Fixmat with properties:

     subject: [1×118188 uint32]
       phase: [1×118188 int32]
       start: [1×118188 int32]
        stop: [1×118188 int32]
           x: [1×118188 single]
           y: [1×118188 single]
         eye: [1×118188 uint8]
    deltacsp: [1×118188 int32]
        file: [1×118188 int32]
     oddball: [1×118188 int32]
     trialid: [1×118188 int32]
         ucs: [1×118188 int32]
         fix: [1×118188 int32]
       chain: [1×118188 double]
       isref: [1×118188 double]
It stores every fixation's attributes in the form of separate vectors. For example, information such as x and y coordinates, participant's index, the image, the condition are stored in the Fixmat.
However, Fixmat variable above is not a simple Matlab structure though, but rather an instance of a Fixmat object, as coded in the FancyCarp Toolbox. The benefit of having a Fixmat object is that there are useful methods built-in in the Fixmat object, such as for example visualizing fixation density maps as heatmaps.
For example, the following code can be used to plot a fixation density map (FDM) based on all subjects (stored in S) during the generalization phase:
S = FPSA_FearGen('get_subjects');
fixmat = FPSA_FearGen('get_fixmat');
v{1} = {'subject' S 'phase' 4};
fixmat.getmaps(v{:});
fixmat.plot
The Fixmat.getmaps method creates an FDM based on the cell array argument v. In the example above,v is used to select all fixations that belong to both phase 4 and subjects S. The method Fixmat.plot plots the computed FDM. In order to create a separate FDM for different conditions or participants we would create a separate cell array for each of the required filtering conditions.
v=[];
c=0;
for ns = S([11 3 8 23]);
  c=c+1;
  v{c} = {'subject' ns 'deltacsp' 0 'phase' 4};
end
fixmat.getmaps(v{:});
fixmat.plot
This will plot a separate FDM for the 4 different participants.
Note how different participants scan faces differently. This is the basis for recent reports that analyzed the scan-path idiosyncrasy during viewing of faces. And the major reason for us to come up with the FPSA as a methodology to investigate how eye movement strategies change with aversive learning during viewing of faces.

Get FDM for the Fixation-Pattern Similarity Analysis

FPSA analysis is conducted on single-participants at a time. The get_fixmap action can be used to gather the required FDMs. It is basically a wrapper around the Fixmat.getmaps method.
>> maps = FPSA_FearGen('get_fixmap',fixmat,{'subject' 2});;
>> size(maps)
ans =
      250000          16
As you can see in maps each FDM is represented as a column vector. As we have 2 phases and 8 different conditions (faces), this amounts to 16 different vectors. This representation is appropriate for the similarity analysis as it can be readily used as an argument to Matlab's pdist

Fixation-Pattern Similarity Analysis

The following command will run a correlation-based similarity analysis on the FDMs of single participants, before (phase = 2) and after (phase =4) aversive learning. {'fix',1:100} indicates that the analysis will include 1st to 100th fixations, that is all the fixations.
1:3 ensures that similarity analysis is ran separately for the 3 runs of the generalization phase (phase = 4). This is important because the baseline phase (phase = 2) entails only one single run. In order to have a valid comparison of the similarity values across the baseline and test phases, the FDMs should contain on average same number of fixations. Computing separate FPSA matrices for each run ensures this.
sim = FPSA_FearGen('get_fpsa_fair',{'fix',1:100},1:3);
>> sim
sim = 
  struct with fields:

    correlation: [74×120 double]
The resulting matrix sim.correlation contains in each row the similarity data from a given participant. The pair-wise similarity values between the 16 FDMs are stored across the columns in a non-redundant format. You can visualize the resulting 16x16 matrix after putting the similarity values back to their positive-definite matrix format with the squareform function. 'plot_fpsa' action is used to do this.
The first quadrant of this matrix shows the similarity relationships between the 8 fixation-density maps recorded during the baseline period, before aversive learning has taken place. The second quadrant shows the same after learning has taken place.

Multi-dimensional Similarity Analysis

Another extremely useful way of representing the similarity relationships between the fixation maps consists of using the multi-dimensional scaling method. Below, I ran an MDS analysis using two dimensions.
fixmat = FPSA_FearGen('get_mdscale',squareform(mean(sim.correlation)),2)
This places a set of dots in such a way that the distances between each dot corresponds to the dissimilarity between the FDMs. Therefore, it is nice visual tool that summarizes the complex disssimilarity matrice, which is sometimes hard to digest. 
With the following piece of code, the upper part of the figure 03 of the manuscript can be produced summing up bundling previous figures.
FPSA_FearGen('figure_03A',FPSA_FearGen('get_fpsa_fair',{'fix' 1:100},1:3))

Analysis of dissimilarity matrices

One major aim in our paper was to understand how the similarity relationships between the FDMs changed with aversive learning. We take a linear modelling approach:
Y = bX
where Y is a non-redundant dissimilarity matrix, X is one of the 3 models we are testing, b are the coefficients that are to be fitted.
>> FPSA_FearGen('FPSA_get_table',{})
ans = 
      FPSA_B        FPSA_G         circle        specific      unspecific     Gaussian    subject    phase
    __________    ___________    ___________    ___________    ___________    ________    _______    _____
      -0.52828      -0.014812        0.70711     4.3298e-17        0.70711    0.48254     1          1    
     -0.064526        -0.3752    -1.0147e-17           -0.5            0.5    0.32924     1          1    
      -0.21919        -0.3426       -0.70711       -0.70711     8.6596e-17    0.25385     1          1    
      -0.28268       -0.20612             -1           -0.5           -0.5    0.32924     1          1    
      -0.35528      -0.052057       -0.70711    -1.2989e-16       -0.70711    0.48254     1          1    
       0.10652     -0.0068816    -1.7938e-16            0.5           -0.5    0.50102     1          1    
       0.27702        0.12585        0.70711        0.70711    -1.7319e-16    0.49959     1          1    
      -0.05106       -0.13439        0.70711    -4.3298e-17        0.70711    0.56373     1          1    
      -0.10373      -0.067047     6.1232e-17    -6.1232e-17     1.2246e-16      0.523     1          1    
       -0.1175       -0.39994       -0.70711    -4.3298e-17       -0.70711    0.56373     1          1  
       ...
The first two columns are the observed dissimilarity values for the first subject in the first phase (see last columns). Columns with names circlespecificunspecific and Gaussian are the modelled dissimilarity values that will be fitted for each participant separately.
In Matlab's statistical toolbox one can fit a linear model (pretty much the same way as in R) as follows:
fitlm(T,'FPSA_B ~ 1 + circle');
To to this for all the participants and models separately, we can run
T = FPSA_FearGen('FPSA_get_table',{});
[A,C] = FPSA_FearGen('FPSA_model_singlesubject',T)  
>> A.model_01
ans = 
  struct with fields:

    w1: [74×2 double]
>> A.model_01
ans = 
  struct with fields:

    w1: [74×2 double]
>> A.model_02
ans = 
  struct with fields:

    w1: [74×2 double]
    w2: [74×2 double]
The results of this analysis can be plotted with the following code, reproducing bottom panels of the figure 03.
FPSA_FearGen('figure_03C',{'fix' 1:100})
Just submitted the following short paper to the 1st Cognitive Computational Neuroscience meeting. I am looking forward to participate!

Model-Based Fixation-Pattern Similarity Analysis Reveals Adaptive Changes in Face-Viewing Strategies Following Aversive Learning

Lea Kampermann (l.kampermann@uke.de)
Department of Systems Neuroscience
University Medical Center Hamburg-Eppendorf

Niklas Wilming (n.wilming@uke.de)
Department of Neurophysiology and Pathophysiology
University Medical Center Hamburg-Eppendorf

Arjen Alink (a.alink@uke.de)
Department of Systems Neuroscience
University Medical Center Hamburg-Eppendorf

Christian Büchel (c.buechel@uke.de)
Department of Systems Neuroscience
University Medical Center Hamburg-Eppendorf

Selim Onat (sonat@uke.de)
Department of Systems Neuroscience
University Medical Center Hamburg-Eppendorf


Abstract:


Learning to associate an event with an aversive outcome typically leads to generalization when similar situations are encountered. In real-world situations, generalization must be based on the sensory evidence collected through active exploration. However, our knowledge on how exploration can be adaptively tailored during generalization is scarce. Here, we investigated learning-induced changes in eye movement patterns using a similarity-based multivariate fixation-pattern analysis. Humans learnt to associate an aversive outcome (a mild electric shock) with one face along a circular perceptual continuum, whereas the most dissimilar face on this continuum was kept neutral. Before learning, eye-movement patterns mirrored the similarity characteristics of the stimulus continuum, indicating that exploration was mainly guided by subtle physical differences between the faces. Aversive learning increased the dissimilarity of exploration patterns. In particular, this increase occurred specifically along the axis separating the shock predicting face from the neutral one. We suggest that this separation of patterns results from an internal categorization process for the newly learnt harmful and safe facial prototypes.
Keywords: Eye movements; Generalization; Categorization; Face Perception; Aversive Learning; Multivariate Pattern Analysis; Pattern Similarity

To avoid costly situations, animals must be able to rapidly predict future adversity based on actively harvested information from the environment. In humans, a central part of active exploration involves eye movements, which can rapidly determine what information is available in a scene. However, we currently do not know the extent to which eye movement strategies are flexible and can be adaptive following aversive learning.

We investigated how aversive learning influences exploration strategies during viewing of faces that were designed to form a circular perceptual continuum (Fig. 1A). One randomly chosen face along this continuum (CS+; Fig. 1, red, see colorwheel) was paired with a mild electric shock, which introduced an adversity gradient based on  physical  similarity  to  the


Figure 1: (A) 8 exploration patterns (FDMs, colored frames) from a representative individual overlaid on 8 face stimuli (numbered 1 to 8) calibrated to span a circular similarity continuum across two dimensions. A pair of maximally dissimilar faces was randomly selected as CS+ (red border) and CS– (cyan border; see color wheel for color code). The similarity relationships among the 8 faces and the resulting exploration patterns are depicted as two 8×8 matrices. (B-E) Multidimensional-scaling representations (top row) and the corresponding dissimilarity matrices (bottom row) depicting four possible scenarios on how learning could change the similarity geometry between the exploration maps (same color scheme; red: CS+; cyan: CS–). These matrices are decomposed onto covariate components (middle row) centered either on the CS+/CS– (specific component) or +90°/–90° faces (unspecific component). A third component is uniquely centered on the CS+ face (adversity component). These components were fitted to the observed dissimilarity matrices, and model selection procedure was carried out.

CS+ face. The most dissimilar face (CS–; Fig. 1, cyan) separated by 180° on the circular continuum was not reinforced and thus stayed neutral. Using this paradigm, we were able to investigate how exploration strategies were modified by both the physical similarity relationships between faces, and the adversity gradient introduced through aversive learning.

We used a variant of representational similarity analysis (Kriegeskorte, Mur, & Bandettini, 2008) that we term “fixation-pattern similarity analysis” (FPSA). FPSA considers exploration patterns as multivariate entities and assesses between-condition dissimilarity of fixation patterns for individual participants (Fig. 1A). We formulated 4 different hypotheses (Bottom-up saliency, increased arousal, adversity categorization, adversity tuning) based on how aversive learning might alter the similarity relationships between exploration patterns when one face on the continuum started to predict adversity (Fig. 1B-E).

Before learning, eye movement patterns mirrored the similarity characteristics of the stimulus continuum, indicating that exploration was mainly guided by subtle physical differences between the faces. Aversive learning resulted in a global increase in dissimilarity of eye movement patterns following learning. Model-based analysis of the similarity geometry indicated that this increase was specifically driven by a separation of patterns along the adversity gradient, in agreement with the adversity categorization model (Fig. 1D). These findings show that aversive learning can introduce substantial remodeling of exploration patterns in an adaptive manner during viewing of faces. In particular, we suggest that separation of patterns for harmful and safe prototypes results from an internal categorization process operating along the perceptual continuum following learning.

References

Kriegeskorte, N., Mur, M., & Bandettini, P. (2008). Representational Similarity Analysis – Connecting the Branches of Systems Neuroscience. Frontiers in Systems Neuroscience, 2. https://doi.org/10.3389/neuro.06.004.2008