multimodal.datasets package
Submodules
multimodal.datasets.base module
- multimodal.datasets.base.load_dict(filename_)
- multimodal.datasets.base.load_npz_X_y(filename_)
- multimodal.datasets.base.save_dict(di_, filename_)
- multimodal.datasets.base.save_npz_X_y(filename_, X, y)
multimodal.datasets.data_sample module
This module contains the DataSample class, MultiModalArray, MultiModalSparseArray, MultiModalSparseInfo and MultiModalData, class The DataSample class encapsulates a sample ‘s components nbL and nbEx numbers, MultiModalArray class inherit from numpy ndarray and contains a 2d data ndarray with the shape (n_samples, n_view_i * n_features_i)
0 |
1 |
2 |
3 |
|---|---|---|---|
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
xxxxxxxx |
xxxx |
xxxx |
xxxx |
MultiModalSparseArray inherit from scipy sparce matrix with the shape (n_samples, n_view_i * n_features_i)
- class multimodal.datasets.data_sample.DataSample(data=None, **kwargs)
Bases:
dictA DataSample instance
- Example:
>>> from multimodal.datasets.base import load_dict >>> from multimodal.tests.datasets.get_dataset_path import get_dataset_path >>> from multimodal.datasets.data_sample import DataSample >>> file = 'input_x_dic.pkl' >>> data = load_dict(get_dataset_path(file)) >>> print(data.__class__) <class 'dict'> >>> s = DataSample(data) >>> type(s.data) <class 'multimodal.datasets.data_sample.MultiModalArray'>
Input:
- Parameters:
- datadict
- kwargsothers arguments
- Attributes:
data{ array like} MultiModalArrayMultiModalArray
- property data
MultiModalArray
- class multimodal.datasets.data_sample.MultiModalArray(data, views_ind=None)
Bases:
ndarray,MultiModalDataMultiModalArray inherit from numpy ndarray
- Parameters:
- datacan be
- dictionary of multiview array with shape = (n_samples, n_features) for multi-view
for each view.
- {0: array([[]],
1: array([[]], …}
- numpy array like with shape = (n_samples, n_features) for multi-view
for each view.
- [[[…]],
[[…]], …]
- {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’
for Multi-view input samples.
- views_indarray-like (default= None ) if None
[0, n_features//2, n_features]) is constructed (2 views) Paramater specifying how to extract the data views from X:
views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view
nis given byX[:, views_ind[n]:views_ind[n+1]].
- Attributes:
- views_indlist of views’ indice (may be None)
- n_viewsint number of views
- shapes_int: list of int numbers of feature for each views
- :Example:
- >>> from multimodal.datasets.base import load_dict
- >>> from multimodal.tests.datasets.get_dataset_path import get_dataset_path
- >>> from multimodal.datasets.data_sample import DataSample
- >>> file = ‘input_x_dic.pkl’
- >>> data = load_dict(get_dataset_path(file))
- >>> print(data.__class__)
- <class ‘dict’>
- >>> multiviews = MultiModalArray(data)
- >>> multiviews.shape
- (120, 240)
- >>> multiviews.shapes_int
- [120, 120]
- >>> multiviews.n_views
- 2
- get_col(view, col)
- get_row(view, row)
- get_view(view)
- set_view(view, data)
- class multimodal.datasets.data_sample.MultiModalData
Bases:
object
- class multimodal.datasets.data_sample.MultiModalSparseArray(*arg, **kwargs)
Bases:
csr_matrix,csc_matrix,MultiModalSparseInfo,MultiModalDataMultiModalArray inherit from numpy ndarray
- Parameters:
- datacan be
- dictionary of multiview array with shape = (n_samples, n_features) for multi-view
for each view.
- {0: array([[]],
1: array([[]], …}
- numpy array like with shape = (n_samples, n_features) for multi-view
for each view.
- [[[…]],
[[…]], …]
- {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’
for Multi-view input samples.
- views_indarray-like (default= None ) if None
[0, n_features//2, n_features]) is constructed (2 views) Paramater specifying how to extract the data views from X:
views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view
nis given byX[:, views_ind[n]:views_ind[n+1]].
- Attributes:
- views_indlist of views’ indice (may be None)
n_views : int number of views
shapes_int: list of int numbers of feature for each views
keys : name of key, where data come from a dictionary
- :Example:
- >>> from multimodal.datasets.base import load_dict
- >>> from multimodal.tests.datasets.get_dataset_path import get_dataset_path
- >>> from multimodal.datasets.data_sample import DataSample
- >>> file = ‘input_x_dic.pkl’
- >>> data = load_dict(get_dataset_path(file))
- class multimodal.datasets.data_sample.MultiModalSparseInfo(data, views_ind=None)
Bases:
object