New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fcma classification #122
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, num_TRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add an _
to attributes set based on the data:
http://scikit-learn.org/stable/developers/contributing.html#estimated-attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.num_voxels_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
""" 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this explanation to the definition of X
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the description of what the method does, change to phrasing from "needs to be" to "is".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about [create_epoch() for i in range(20)]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the review
|
||
Parameters | ||
---------- | ||
X: a list of numpy array in shape [nun_TRs, num_voxels] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
""" 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch(), | ||
create_epoch(), create_epoch()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
Parameters | ||
---------- | ||
X: a list of numpy array in shape [num_TRs, num_voxels] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP 8 names, please.
* 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.