Utility Functions¶
IO¶
- mvlearn.utils.check_Xs(Xs, multiview=False, enforce_views=None, copy=False, return_dimensions=False)[source]¶
- Checks Xs and ensures it to be a list of 2D matrices. - Parameters
- Xs (nd-array, list) -- Input data. 
- multiview (boolean, (default=False)) -- If True, throws error if just 1 data matrix given. 
- enforce_views (int, (default=not checked)) -- If provided, ensures this number of views in Xs. Otherwise not checked. 
- copy (boolean, (default=False)) -- If True, the returned Xs is a copy of the input Xs, and operations on the output will not affect the input. If False, the returned Xs is a view of the input Xs, and operations on the output will change the input. 
- return_dimensions (boolean, (default=False)) -- If True, the function also returns the dimensions of the multiview dataset. The dimensions are n_views, n_samples, n_features where n_samples and n_views are respectively the number of views and the number of samples, and n_features is a list of length n_views containing the number of features of each view. 
 
- Returns
- Xs_converted (object) -- The converted and validated Xs (list of data arrays). 
- n_views (int) -- The number of views in the dataset. Returned only if - return_dimensionsis- True.
- n_samples (int) -- The number of samples in the dataset. Returned only if - return_dimensionsis- True.
- n_features (list) -- List of length - n_viewscontaining the number of features in each view. Returned only if- return_dimensionsis- True.
 
 
- mvlearn.utils.check_Xs_y(Xs, y, multiview=False, enforce_views=None, return_dimensions=False)[source]¶
- Checks Xs and y for consistent length. Xs is set to be of dimension 3. - Parameters
- Xs (nd-array, list) -- Input data. 
- y (nd-array, list) -- Labels. 
- multiview (boolean, (default=False)) -- If True, throws error if just 1 data matrix given. 
- enforce_views (int, (default=not checked)) -- If provided, ensures this number of views in Xs. Otherwise not checked. 
- return_dimensions (boolean, (default=False)) -- If True, the function also returns the dimensions of the multiview dataset. The dimensions are n_views, n_samples, n_features where n_samples and n_views are respectively the number of views and the number of samples, and n_features is a list of length n_views containing the number of features of each view. 
 
- Returns
- Xs_converted (object) -- The converted and validated Xs (list of data arrays). 
- y_converted (object) -- The converted and validated y. 
- n_views (int) -- The number of views in the dataset. Returned only if - return_dimensionsis- True.
- n_samples (int) -- The number of samples in the dataset. Returned only if - return_dimensionsis- True.
- n_features (list) -- List of length - n_viewscontaining the number of features in each view. Returned only if- return_dimensionsis- True.
 
 
- mvlearn.utils.check_Xs_y_nan_allowed(Xs, y, multiview=False, enforce_views=None, num_classes=None, max_classes=None, min_classes=None)[source]¶
- Checks Xs and y for consistent length. Xs is set to be of dimension 3. The labels (y) are allowed to be np.nan. - Parameters
- Xs (nd-array, list) -- Input data. 
- y (nd-array, list) -- Labels. 
- multiview (boolean, default=False) -- If True, throws error if just 1 data matrix given. 
- enforce_views (int, (default=not checked)) -- If provided, ensures this number of views in Xs. Otherwise not checked. 
- num_classes (int, default=None) -- Number of classes that must appear in the labels. If none, then not checked. 
- max_classes (int, default=None) -- Maximum number of classes that must appear in labels. If none, then not checked. 
- min_classes (int, default=None) -- Minimum number of classes that must appear in labels. If none, then not checked. 
 
- Returns
- Xs_converted (object) -- The converted and validated Xs (list of data arrays). 
- y_converted (object) -- The converted and validated y.