parameter:
n : int
The total number of elements in the dataset.
n_iter : int (default 10)
Reshuffle and split the number of iterations.
test_size : float (default 0.1), int, or None
If it is float type data, this number should be between 0-1.0, representing the proportion of the test set. If it is an int type, it represents the number of test sets. If it is None, the value will be automatically set to the complement of the size of the train set set
train_size : float, int, or None (default is None)
If it is a float type, it should be between 0 and 1, and represents the proportion of the data set in the train set split. If it is an int type, it represents the number of samples in the train set. If it is None, the value will be automatically set to test complement of set size
random_state : int or RandomState
Pseudo-random number generator state for random sampling.
- >>> from sklearn import cross_validation
- >>> rs = cross_validation.ShuffleSplit(4, n_iter=3,
- ... test_size=.25, random_state=0)
- >>> len(rs)
- 3
- >>> print(rs)
- ...
- ShuffleSplit(4, n_iter=3, test_size=0.25, ...)
- >>> for train_index, test_index in rs:
- ... print("TRAIN:", train_index, "TEST:", test_index)
- ...
- TRAIN: [3 1 0] TEST: [2]
- TRAIN: [2 1 3] TEST: [0]
- TRAIN: [0 2 1] TEST: [3]
- >>> rs = cross_validation.ShuffleSplit(4, n_iter=3,
- ... train_size=0.5, test_size=.25, random_state=0)
- >>> for train_index, test_index in rs:
- ... print("TRAIN:", train_index, "TEST:", test_index)
- ...
- TRAIN: [3 1] TEST: [2]
- TRAIN: [2 1] TEST: [0]
- TRAIN: [0 2] TEST: [3]
- .. automethod :: __init__