Skip to content
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

Merged
merged 20 commits into from Sep 30, 2016
Merged

Fcma classification #122

merged 20 commits into from Sep 30, 2016

Conversation

yidawang
Copy link
Member

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


Parameters
----------
X: a list of numpy array in shape [nun_TRs, num_voxels]
Copy link
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
Member Author

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
Copy link
Member

@mihaic mihaic Sep 29, 2016

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
Member Author

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
Copy link
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
Member Author

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
Copy link
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
Member Author

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
Copy link
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
Member Author

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.
Copy link
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
Member Author

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.
Copy link
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
Member Author

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()]
Copy link
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
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

@yidawang yidawang left a 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]
Copy link
Member Author

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.
Copy link
Member Author

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.
Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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()]
Copy link
Member Author

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
Copy link
Member Author

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]
Copy link
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.


logger = logging.getLogger(__name__)

def readActivityData(dir, file_extension, mask_file):
Copy link
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.

None yet

2 participants