# RF: use masks in predictions and cross-validation #714

Merged
merged 19 commits into from Oct 26, 2015

## Conversation

Projects
None yet
3 participants
Member

### arokem commented Sep 18, 2015

 This is an improvement on the previous API, which did not allow using masks for multi-voxel predictions, making predictions for cross-validation un-necessarily slow.

Member

### arokem commented Sep 18, 2015

 Changed to WIP, while I try out a few more things.

Member

### arokem commented Sep 18, 2015

 OK - this is ready for review. Note that many of the changes are PEP8 cleanups. If you are interested in the functional changes this is the relevant diff: master...315c0be

Member

### arokem commented Oct 18, 2015

 I think I've found the source of the previous test failures: the multi-voxel prediction function was allocating an empty array for the results, and this came up with a nan ever so often, in a random way. In general, empty sure is a dangerous function!

### Garyfallidis reviewed Oct 19, 2015

 @@ -1017,7 +1024,8 @@ def linearity(self): .. math:: Linearity = \frac{\lambda_1-\lambda_2}{\lambda_1+\lambda_2+\lambda_3} Linearity = \frac{\lambda_1-\lambda_2}{\lambda_1+\lambda_2+\lambda_3}

#### Garyfallidis Oct 19, 2015

Member

Question. Have you checked that breaking the line here renders fine?

#### arokem Oct 19, 2015

Member

Yes - the docs render just fine. I have found a few typos in the meanwhile, so adding the fixes for that.

Member

### Garyfallidis commented Oct 19, 2015

 Okay this looks good to me. Can someone have another look?

### arokem added some commits Sep 17, 2015

 RF: Allow using a mask for predictions from reconstruction models. 
 f292d85 
 TST: Add testing for prediction with and w/o mask in mutli_voxel_fit. 
 b1c9e87 
 BF: Move the mask to outside the folds loop. 
Otherwise it gets set to None after one loop.
 efba242 
 TST: Test prediction from the dki Fit object. 
 f024550 
 PEP8 fixes. 
More to come!
 950b180 
 PEP8: dti.py 
 c7e9bd8 
 BF: Use sigma in this mode. 
 021a8f7 
 PEP8 in dti.py 
 e0e3560 
 PEP8 in multi_voxel.py 
 947128d 
 PEP8 in test_cross_validation.py 
 143f030 
 PEP8 in test_dti.py 
 817e50f 
 BF: Add back names from DTI that are used through dki. 
 a6cd4cd 
 Whitespace. 
 db4f424 
 Temporarily amend this test. 
 fcfc59b 
 TST: More realistic mask testing. 
 6a73b6b 
 TST: Fix test condition. 
 58dacb2 
 BF: Since we are multiplying later on, use zeros, instead of empty. 
This is because empty can produce spurious nan's in an unexpected manner, and
since we multiply by 0 later on we might get these spurious nans in the result
 a04454d 
 DOC: Remove one of the notes sections here, for better rendering. 
 674a665 
 DOC: typos. 
 7dd1a3d 

Member

### arokem commented Oct 22, 2015

 This is now rebased on current master. @MrBago or @stefanv - any chance to get one of you to take a quick look?
Contributor

### stefanv commented Oct 23, 2015

 This looks good to me, Ariel.

### Garyfallidis added a commit that referenced this pull request Oct 26, 2015

 Merge pull request #714 from arokem/mask-predictions 
RF: use masks in predictions and cross-validation
 6078c3a 

### Garyfallidis merged commit 6078c3a into nipy:master Oct 26, 2015 1 check passed

#### 1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details