Fcma partial sim matrix #168
Conversation
@@ -245,6 +303,12 @@ def fit(self, X, y): | |||
and prepared for correlation computation. | |||
assuming all elements of X has the same num_voxels value | |||
y: labels, len(X) equals len(Y) | |||
num_training_samples: int, default None | |||
the number of samples that used in the training, |
mihaic
Jan 25, 2017
Contributor
Typo: "that used".
Typo: "that used".
yidawang
Jan 25, 2017
Author
Member
done
done
@@ -79,27 +91,43 @@ class Classifier(BaseEstimator): | |||
num_samples_: int | |||
The number of samples of the training set | |||
num_digits_: int | |||
The number of digit of the first value of the kernel matrix, |
mihaic
Jan 25, 2017
Contributor
Typo: "number of digit".
Typo: "number of digit".
yidawang
Jan 25, 2017
Author
Member
done
done
Used for SVM with precomputed kernel, | ||
every time only compute correlation between num_process_voxels and | ||
the whole brain to aggregate the kernel matrices. | ||
This is to better use the memory |
mihaic
Jan 25, 2017
Contributor
You mean to save memory? Also, please write sentences in docstrings, including full stops and all other punctuation.
You mean to save memory? Also, please write sentences in docstrings, including full stops and all other punctuation.
yidawang
Jan 25, 2017
Author
Member
yes, computing similarity matrices portion by portion can save the memory so as to handle correlations at a larger scale.
yes, computing similarity matrices portion by portion can save the memory so as to handle correlations at a larger scale.
@@ -57,7 +63,10 @@ class Classifier(BaseEstimator): | |||
default None |
mihaic
Jan 25, 2017
Contributor
Attributes are not set during initialization. They are not None
.
Attributes are not set during initialization. They are not None
.
yidawang
Jan 25, 2017
Author
Member
deleted this line
deleted this line
@@ -57,7 +63,10 @@ class Classifier(BaseEstimator): | |||
default None | |||
training_data\_ is None except clf is SVM.SVC with precomputed kernel, | |||
in which case training data is needed to compute | |||
the similarity vector for each sample to be classified | |||
the similarity vector for each sample to be classified. | |||
However, if the test samples are also provided during the fit, |
mihaic
Jan 25, 2017
Contributor
Please add a paragraph at the beginning of the docstring explaining how testing data can be passed to fit
as an optimization.
Please add a paragraph at the beginning of the docstring explaining how testing data can be passed to fit
as an optimization.
yidawang
Jan 26, 2017
Author
Member
done
done
subsequent operations, e.g. getting decision values of the prediction | ||
subsequent operations, e.g. getting decision values of the prediction. | ||
test_data\_ may also be set in the fit method | ||
if SVM.SVC with precomputed kernel and the test samples are known. |
mihaic
Jan 25, 2017
Contributor
Use the full package name in docstrings for modules outside BrainIAK, i.e., sklearn.svm.SVC
.
Use the full package name in docstrings for modules outside BrainIAK, i.e., sklearn.svm.SVC
.
yidawang
Jan 25, 2017
Author
Member
done
done
Parameters | ||
---------- | ||
X: a list of numpy array in shape [num_TRs, num_voxels] | ||
len(X) is the number of samples | ||
assuming all elements of X has the same num_voxels value | ||
start_voxel: int, default 0 | ||
the starting voxel id for correlation computation | ||
num_voxels_1: int, default None |
mihaic
Jan 25, 2017
Contributor
Please use a descriptive name.
Please use a descriptive name.
yidawang
Jan 26, 2017
Author
Member
done
done
which is set when the similarity matrix is constructed | ||
portion by portion so the similarity vectors of the | ||
test data have to be computed here. | ||
If it is set, only those samples will be used to fit the model |
mihaic
Jan 25, 2017
Contributor
Document also that this only applies to SVMs with precomputed kernels, where it must be present.
Document also that this only applies to SVMs with precomputed kernels, where it must be present.
yidawang
Jan 26, 2017
Author
Member
done
done
@@ -27,25 +28,32 @@ | |||
logging.basicConfig(level=logging.INFO, format=format, stream=sys.stdout) | |||
logger = logging.getLogger(__name__) | |||
|
|||
def example_of_aggregating_sim_matrix(raw_data, labels): | |||
# aggregate the similarity matrix to save memory | |||
use_clf = svm.SVC(kernel='precomputed', shrinking=False, C=1) |
mihaic
Jan 25, 2017
Contributor
use_clf
seems like a Boolean name. How about svm_clf
?
use_clf
seems like a Boolean name. How about svm_clf
?
yidawang
Jan 26, 2017
Author
Member
done
done
add partial similarity matrix algorithm in correlation-based classification
add the corresponding test code
rename some methods
improve the example code