Fcma classification#122
Conversation
yidawang
commented
Sep 29, 2016
- add correlation-based classification of FCMA
- restructure the example code of FCMA
- fix minor typos
|
|
||
| Parameters | ||
| ---------- | ||
| X: a list of numpy array in shape [nun_TRs, num_voxels] |
| Parameters | ||
| ---------- | ||
| X: a list of numpy array in shape [nun_TRs, num_voxels] | ||
| len(X) equals num_test_samples |
There was a problem hiding this comment.
As far as I understand, you are defining the variable num_test_samples here in the docstring. This is confusing. Use len(X) in this docstring, not num_test_samples.
| epochs_per_subj=0): | ||
| self.clf = clf | ||
| self.epochs_per_subj = epochs_per_subj | ||
| self.training_data = None |
There was a problem hiding this comment.
Only set parameters passed to __init__. So do not set training_data, num_voxels, and num_samples. If you are thinking about it, do not add them as parameters to __init__, because they are data dependent. See the scikti-learn documentation:
http://scikit-learn.org/stable/developers/contributing.html#instantiation
| num_samples = len(X) | ||
| num_voxels = X[0].shape[1] # see assumption above | ||
| self.num_voxels = num_voxels | ||
| self.num_samples = num_samples |
There was a problem hiding this comment.
You should add an _ to attributes set based on the data:
http://scikit-learn.org/stable/developers/contributing.html#estimated-attributes
| len(X) equals num_test_samples | ||
| if num_test_samples > 0: normalization is done | ||
| on all test samples | ||
| num_voxels equals the one used in the model |
| """ use a trained model to predict correlation data | ||
|
|
||
| the input data X is activity data filtered by top voxels | ||
| and prepared for correlation computation. |
There was a problem hiding this comment.
Move this explanation to the definition of X below.
| X needs to be first converted to correlation, | ||
| and then normalized across all samples in the list | ||
| if len(X) > 1, | ||
| and then predicted via self.clf. |
There was a problem hiding this comment.
If this is the description of what the method does, change to phrasing from "needs to be" to "is".
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch()] |
There was a problem hiding this comment.
How about [create_epoch() for i in range(20)]?
yidawang
left a comment
There was a problem hiding this comment.
thanks for the review
|
|
||
| Parameters | ||
| ---------- | ||
| X: a list of numpy array in shape [nun_TRs, num_voxels] |
| """ use a trained model to predict correlation data | ||
|
|
||
| the input data X is activity data filtered by top voxels | ||
| and prepared for correlation computation. |
| X needs to be first converted to correlation, | ||
| and then normalized across all samples in the list | ||
| if len(X) > 1, | ||
| and then predicted via self.clf. |
| Parameters | ||
| ---------- | ||
| X: a list of numpy array in shape [nun_TRs, num_voxels] | ||
| len(X) equals num_test_samples |
| len(X) equals num_test_samples | ||
| if num_test_samples > 0: normalization is done | ||
| on all test samples | ||
| num_voxels equals the one used in the model |
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch(), | ||
| create_epoch(), create_epoch()] |
| num_samples = len(X) | ||
| num_voxels = X[0].shape[1] # see assumption above | ||
| self.num_voxels = num_voxels | ||
| self.num_samples = num_samples |
|
|
||
| Parameters | ||
| ---------- | ||
| X: a list of numpy array in shape [num_TRs, num_voxels] |
There was a problem hiding this comment.
How about self.num_voxels_? Then you can also remove the last line below.
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| def readActivityData(dir, file_extension, mask_file): |
* Ignore /build directory * Some Windows and Visual Studio .gitignores
* First attempt at fixing psubscribe. psubscribe_success_test will fail * psubscribe test * SUBSCRIBE returns the number of subscriptions, not success * Comment out failing test.