enh - add Y transformation keyword argument in NormativeModel to enforce positivity#372
enh - add Y transformation keyword argument in NormativeModel to enforce positivity#372
Conversation
|
Will this solve the problem addressed in issue #365? As I see it, since the standardization happens after the log transform, this can and probably will still yield negative values, resulting in invalid input to WarpLog. Additionally, why would we apply a log transform as a preparation for a log transform? Some ideas:
I do agree the option to add a log transform on Y as it is implemented now is a good idea, and it should be kept somehow. I just don't think it really solves the problem of using WarpLog + standardize. EDIT: I realize now that this PR is not intended to solve #365. |
|
as you mentioned in the end of your previous comment, this pr is not meant to solve #365, but #356. #356 was proposed by @amarquand. It is meant to not allow for strictly positive response variables (like brain volumes or WM hypoinstensities) to have negative centiles (see for example, fig. 6(e) in [1] For #365 for now we implemented something close to your first idea: see #366. However, your second idea is also a good one. We can make an issue to implement it. |
|
Indeed. We have a user that wants to apply the shash model to strictly positive data, and get the centiles back in the original space. But @AuguB is right that the interaction with the inscaler and outscaler needs to be carefully considered. Has this been tested? |
|
I wrote an example script which i have locally. I used inscaler and outscaler = 'standardise', dataset fcon1000: 1. BLR(heteroskedastic=True) 2. HBR() (default parameters) @amarquand how do these results look? |
|
I will add a test script for this feature and then we are ready to merge it |
That way it is clear what is tested: main: tests the main normative model functions helper: tests the helper functions
- Add BLR model fixtures (instead of test model fixtures) - adjust assertions: centiles and yhat should be > -1
test_normative_model is the same as test_normative_model_helper
|
After discussion with @amarquand: I will implement two keyword arguments
In the case of 'log' we expect all centiles >=0 vs 'log1p' we expect centiles >=-1 |







Closes #356
If Y<-1 then log(Y+1) cant be computed (ValueError) but I expect Y to always be >=-1 (since the functionality i added in this pr is only for data that are always positive). If we want to be conservative we can add though a check like:
We can still consider to add a test and/or an example.