turicreate.SArray.sample¶
-
SArray.
sample
(fraction, seed=None, exact=False)¶ Create an SArray which contains a subsample of the current SArray.
Parameters: - fraction : float
Fraction of the rows to fetch. Must be between 0 and 1. if exact is False (default), the number of rows returned is approximately the fraction times the number of rows.
- seed : int, optional
The random seed for the random number generator.
- exact: bool, optional
Defaults to False. If exact=True, an exact fraction is returned, but at a performance penalty.
Returns: - out : SArray
The new SArray which contains the subsampled rows.
Examples
>>> sa = turicreate.SArray(range(10)) >>> sa.sample(.3) dtype: int Rows: 3 [2, 6, 9]