Skip to content

Fcma classification#122

Merged
mihaic merged 20 commits into
brainiak:masterfrom
yidawang:fcma_classification
Sep 30, 2016
Merged

Fcma classification#122
mihaic merged 20 commits into
brainiak:masterfrom
yidawang:fcma_classification

Conversation

@yidawang

Copy link
Copy Markdown
Member
  1. add correlation-based classification of FCMA
  2. restructure the example code of FCMA
  3. fix minor typos

Comment thread brainiak/fcma/classifier.py Outdated

Parameters
----------
X: a list of numpy array in shape [nun_TRs, num_voxels]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, num_TRs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
Parameters
----------
X: a list of numpy array in shape [nun_TRs, num_voxels]
len(X) equals num_test_samples

@mihaic mihaic Sep 29, 2016

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
epochs_per_subj=0):
self.clf = clf
self.epochs_per_subj = epochs_per_subj
self.training_data = None

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
num_samples = len(X)
num_voxels = X[0].shape[1] # see assumption above
self.num_voxels = num_voxels
self.num_samples = num_samples

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.num_voxels_?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
""" use a trained model to predict correlation data

the input data X is activity data filtered by top voxels
and prepared for correlation computation.

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
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.

Copy link
Copy Markdown
Member

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".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread tests/fcma/test_classification.py Outdated
create_epoch(), create_epoch(),
create_epoch(), create_epoch(),
create_epoch(), create_epoch(),
create_epoch(), create_epoch()]

Copy link
Copy Markdown
Member

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)]?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@yidawang yidawang left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review

Comment thread brainiak/fcma/classifier.py Outdated

Parameters
----------
X: a list of numpy array in shape [nun_TRs, num_voxels]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
""" use a trained model to predict correlation data

the input data X is activity data filtered by top voxels
and prepared for correlation computation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
Parameters
----------
X: a list of numpy array in shape [nun_TRs, num_voxels]
len(X) equals num_test_samples

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread tests/fcma/test_classification.py Outdated
create_epoch(), create_epoch(),
create_epoch(), create_epoch(),
create_epoch(), create_epoch(),
create_epoch(), create_epoch()]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated
num_samples = len(X)
num_voxels = X[0].shape[1] # see assumption above
self.num_voxels = num_voxels
self.num_samples = num_samples

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread brainiak/fcma/classifier.py Outdated

Parameters
----------
X: a list of numpy array in shape [num_TRs, num_voxels]

Copy link
Copy Markdown
Member

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.

Comment thread examples/fcma/file_io.py Outdated

logger = logging.getLogger(__name__)

def readActivityData(dir, file_extension, mask_file):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8 names, please.

@mihaic mihaic merged commit 33cc14b into brainiak:master Sep 30, 2016
@yidawang yidawang deleted the fcma_classification branch September 30, 2016 04:11
danielsuo pushed a commit that referenced this pull request Nov 16, 2017
* Ignore /build directory

* Some Windows and Visual Studio .gitignores
danielsuo pushed a commit that referenced this pull request Nov 16, 2017
* First attempt at fixing psubscribe. psubscribe_success_test will fail

* psubscribe test

* SUBSCRIBE returns the number of subscriptions, not success

* Comment out failing test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants