gclda.dataset.Dataset¶
-
class
gclda.dataset.Dataset(dataset_label, data_directory, mask_file=None)[source]¶ Class object for a gcLDA dataset.
A Dataset contains data needed to run gcLDA models. It can also be used to view dataset information and can be saved to a pickled file.
Parameters: - dataset_label :
str The name of the gcLDA dataset. Also the name of a subfolder in
data_directorycontaining four files (word_indices.txt,word_labels.txt,peak_indices.txt, andpmids.txt) with the data needed to create the dataset.- data_directory :
str The path to the folder containing the data. Should contain a subdirectory named after
dataset_labelwith files needed to generate a Dataset.- mask_file :
str, optional A brain mask file used to define the voxels included in the dataset. If not provided, the mask file used by Neurosynth will be used by default.
Attributes: - dataset_label :
str The name of the dataset.
- mask_img :
nibabel.Nifti1Image A nifti object of the mask file.
- word_labels :
listofstr List of word-strings (wtoken_word_idx values are indices into this list).
- pmids :
listofint List of PubMed IDs (i.e., studies) in dataset.
- wtoken_doc_idx :
listofint List of document-indices for word-tokens.
- wtoken_word_idx :
listofint List of word-indices for word-tokens.
- ptoken_doc_idx :
listofint List of document-indices for peak-tokens x.
- peak_vals :
numpy.ndarrayofint A focus-x-3 array of X, Y, and Z coordinates of foci in dataset in stereotactic (generally MNI152) space.
Methods
display_dataset_summary()View dataset summary. load(filename)Load a pickled Dataset instance from file. save(filename)Pickle the Dataset instance to the provided file. view_doc_labels([n_pmids])View first n_pmidsPMIDs in dataset.view_peak_indices([n_peak_indices])View first n_peak_indicespeak indices.view_word_indices([n_word_indices])View first n_word_indicesword indices.view_word_labels([n_word_labels])View first n_word_labelswords in dataset.next -
__init__(dataset_label, data_directory, mask_file=None)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
classmethod
load(filename)[source]¶ Load a pickled Dataset instance from file. If the filename ends with ‘z’, it will be assumed that the file is compressed, and gzip will be used to load it. Otherwise, it will be assumed that the file is not compressed.
Parameters: - filename :
str File with saved Dataset instance.
Returns: - dataset :
gclda.dataset.Dataset Loaded Dataset instance.
- filename :
- dataset_label :