running ridge regression - jungheejung/life-encoding GitHub Wiki

1. datastructure

first chunk loads dataset

  • if model is visual → will load data via get_visual_stim_for_fold
  • if model is narrative → will load data via get_narrative_stim_for_fold
if model == 'visual':
    train_stim, test_stim = get_visual_stim_for_fold('{0}_{1}'.format(model, stimfile), fold_shifted, included)
else:
    train_stim, test_stim = get_narrative_stim_for_fold('{0}_{1}'.format(model, stimfile), fold_shifted, included)

loaded train_stim structure

  • train_stim has 3 numpy arrays (three runs)
  • train_stim[0].shape = (338, 1200)
  • 338 refers to video timepoints per run (each run differs) PLEASE confirm
  • 1200 refers to 300 annotation vectors stacked for 4 runs

successfully ran:

Loading fMRI GIFTI data for HA in test subj space and using sub-rid000001 as test participant...
/dartfs-hpc/rc/home/1/f0042x1/.conda/envs/haxby_mvpc/lib/python2.7/site-packages/mvpa2/datasets/gifti.py:77: DeprecationWarning: giftiio.read function deprecated. Use nibabel.load() instead.

* deprecated from version: 2.1
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 4.0
  samples = giftiio.read(samples)
('train', 2, (338, 37476))
('train', 3, (369, 37476))
('train', 4, (403, 37476))
('test', 1, (366, 37476))

Loading fMRI GIFTI data for HA in test subj space and using sub-rid000005 as test participant...
('train', 2, (338, 37476))
('train', 3, (369, 37476))
('train', 4, (403, 37476))
('test', 1, (366, 37476))

Loading fMRI GIFTI data for HA in test subj space and using sub-rid000006 as test participant...
('train', 2, (338, 37476))
('train', 3, (369, 37476))
('train', 4, (403, 37476))
('test', 1, (366, 37476))

2. need to identify:

test_ds = mv.niml.read('/dartfs-hpc/scratch/cara/models/niml/ws/ws_run1_singlealpha.{0}.niml.dset'.format(half)) currently, I changed the test_ds to a different file because the codeblock bellow seemed to be looking for cortical vertices.

# First let's create mask of cortical vertices excluding medial wall
cortical_vertices = {}
for half in ['lh', 'rh']:
    test_ds = mv.niml.read('/dartfs-hpc/scratch/cara/models/niml/ws/ws_run1_singlealpha.{0}.niml.dset'.format(half))
    cortical_vertices[half] = np.ones((n_vertices))
    cortical_vertices[half][np.sum(test_ds.samples[1:, :] != 0, axis=0) == 0] = 0

print('Model: {0}\nStim file: {1}\nHemi: {2}\nRuns in training: {3}\nRun in test: {4}\n'.format(model, stimfile, hemi, included, fold_shifted))
  • get_visual_stim_for_fold:
  • get_sound_envelope(): present, /idata/DBIC/cara/life/data/audio/life_part1.wav
  • get_narrative_stim_for_fold(stimfile, fold_shifted, included): stimfile = /idata/DBIC/cara/w2v/w2v_features/visual_actions.npy

sam_data_dir = '/idata/DBIC/snastase/life' sam_data_dir, '{0}_task-life_acq-{1}vol_run-0{2}.{3}.tproject.gii'

get_ws_data(test_p, fold_shifted, included, hemi): get_aa_data(test_p, fold_shifted, included, hemi): get_ha_common_data(test_p, mappers, fold_shifted, included, hemi): get_ha_testsubj_data(test_p, mappers, fold_shifted, included, hemi):

3. update

successful run with visual model, "all annotations"