run_all
run_all(cross_validation='simple', subject='UTS02', feature='eng1000', n_train_stories=[1, 3, 5], test_story='wheretheressmoke', n_repeats=5, ndelays=5, interpolation='lanczos', ridge_implementation='ridge_huth', do_shuffle=False, use_cache=True, keep_train_stories_in_mem=True, seed=123, alphas=np.logspace(1, 3, 10), nboots=50, chunklen=40, nchunks=125, singcutoff=1e-10, single_alpha=False, use_corr=True, run_folder_name='')
Runs encoding models n_repeat times and saves results data/runs to disk.
The following outputs are saved:
0. params.json : the parameters for the run
data/runs/date-id/params.json
1. scores_mean.npy : the mean scores across folds
data/runs/date-id/predictor/subject/n_training_stories/shuffle/scores_mean.npy
2. scores.npy : the score for each separate fold
data/runs/date-id/predictor/subject/n_training_stories/shuffle/fold/scores.npy
3. weights.npy : the model weights for each separate fold
data/runs/date-id/predictor/subject/n_training_stories/shuffle/fold/weights.npy
4. best_alphas.npy : the best alphas for each voxel in that fold
data/runs/date-id/predictor/subject/n_training_stories/shuffle/fold/best_alphas.npy
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
(loocv, simple)
|
|
"loocv"
|
|
str or list of str
|
Subject identifier.
Can be one or a list of : { |
"UTS02"
|
|
(all, envelope, eng1000)
|
Which predictor to run.
|
"all"
|
|
int or list of int
|
Number o of training stories for the encoding model. If a list is given, the encoding model will be fitted with each number separately. |
[1, 3, 5]
|
|
str or None
|
The story to use as the test set. If |
"wheretheressmoke"
|
|
int
|
By how many TR's features are delayed to model the HRF. For |
5
|
|
(lanczos, average)
|
Whether to use lanczos interpolation or just average the words within a TR.
Only applies if |
"lanczos"
|
|
str
|
Which ridge regression implementation to use.
|
'ridge_huth'
|
|
bool
|
Whether or not to run model fits with predictors shuffled (as a control). A separate subfolder ('shuffled') will be created in the run folder with these results. |
False
|
|
bool
|
Whether features are cached and reused.
Only applies if |
True
|
|
bool
|
Whether stories are kept in memory after first loading. Unless when using all
stories turning this off will reduce the memory footprint, but increase the
time is spent loading data. Only works if |
True
|
|
Optional[int]
|
Seed determining sampling of stories |
123
|
|
ndarray
|
Array of alpha values to optimize over. |
logspace(1, 3, 10)
|
|
int
|
The number of bootstrap samples to run. 15 to 30 works well. Only active for ridge_huth="ridge_huth". |
50
|
|
int
|
On each sample, the training data is broken into chunks of this length. This should be a few times longer than your delay/STRF. e.g. for a STRF with 3 delays, I use chunks of length 10. Only active for ridge_huth="ridge_huth". |
40
|
|
int
|
The number of training chunks held out to test ridge parameters for each bootstrap sample. The product of nchunks and chunklen is the total number of training samples held out for each sample, and this product should be about 20 percent of the total length of the training data. |
125
|
|
float
|
The first step in ridge regression is computing the singular value decomposition (SVD) of the stimulus Rstim. If Rstim is not full rank, some singular values will be approximately equal to zero and the corresponding singular vectors will be noise. These singular values/vectors should be removed both for speed (the fewer multiplications the better!) and accuracy. Any singular values less than singcutoff will be removed. Only active for ridge_huth="ridge_huth". |
1e-10
|
|
boolean
|
Whether to use a single alpha for all responses. Good foridentification/decoding. Only active for ridge_huth="ridge_huth". |
False
|
|
boolean
|
If True, this function will use correlation as its metric of model fit. If False, this function will instead use variance explained (R-squared) as its metric of model fit. For ridge regression this can make a big difference -- highly regularized solutions will have very small norms and will thus explain very little variance while still leading to high correlations, as correlation is scale-free while R**2 is not. Only active for ridge_huth="ridge_huth". |
True
|
|
str
|
The name of the folder in the runs directory (as specificed in
|
''
|
Source code in src/encoders/run_all.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|