JustEachGroup¶
-
class
mastml.legos.data_splitters.
JustEachGroup
[source]¶ Bases:
sklearn.base.BaseEstimator
,sklearn.base.TransformerMixin
Class to train the model on one group at a time and test it on the rest of the data This class wraps scikit-learn’s LeavePGroupsOut with P set to n-1. More information is available at: http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.LeavePGroupsOut.html
- Args:
- None (only object instance)
- Methods:
get_n_splits: method to calculate the number of splits to perform
- Args:
- groups: (numpy array), array of group labels
- Returns:
- (int), number of unique groups, indicating number of splits to perform
split: method to perform split into train indices and test indices
- Args:
- X: (numpy array), array of X features y: (numpy array), array of y data groups: (numpy array), array of group labels
- Returns:
- (numpy array), array of train and test indices
Methods Summary
get_n_splits
([X, y, groups])split
(X, y, groups)Methods Documentation