umbmid/ai/preprocessing.py
def shuffle_arrays(arrays_list, rand_seed=0, return_seed=False):
    """Shuffle arrays to maintain inter-array ordering

    Shuffles each array in the list of arrays, arrays_list, such that
    the inter-array order is maintained (i.e., the zeroth element of
    the all arrays before shuffling corresponds to the nth element of
    all arrays after shuffling)

    Parameters
    ---------
    arrays_list : list
        List containing each array that will be shuffled
    rand_seed : int
        The seed to use for shuffling each array
    return_seed : bool
        If True, will return the seed used to shuffle the arrays (for
        reproducibility)

    Returns
    -------
    shuffled_arrs : list
        List containing the shuffled arrays
    rand_seed :
        The seed that was used to shuffle the arrays
    """

    shuffled_arrs = []  # Init arr for storing the shuffled arrays

    for array in arrays_list:  # For each array in the list
        np.random.seed(rand_seed)  # Set the seed

        if type(array) == list:  # If the 'array' is actually a list

            # Copy the list into a new var that will be shuffled
            shuffled_arr = [ii for ii in array]

        else:  # If the array is an array

            # Make a copy that will be shuffled
            shuffled_arr = array * np.ones_like(array)

        np.random.shuffle(shuffled_arr)  # Shuffle the array

        # Append the shuffled array to the list of shuffled arrays
        shuffled_arrs.append(shuffled_arr)

    if return_seed:  # If returning the seed, then do so
        return shuffled_arrs, rand_seed
    else:
        return shuffled_arrs
Shuffle arrays to maintain inter-array ordering

    Shuffles each array in the list of arrays, arrays_list, such that
    the inter-array order is maintained (i.e., the zeroth element of
    the all arrays before shuffling corresponds to the nth element of
    all arrays after shuffling)

    Parameters
    ---------
    arrays_list : list
        List containing each array that will be shuffled
    rand_seed : int
        The seed to use for shuffling each array
    return_seed : bool
        If True, will return the seed used to shuffle the arrays (for
        reproducibility)

    Returns
    -------
    shuffled_arrs : list
        List containing the shuffled arrays
    rand_seed :
        The seed that was used to shuffle the arrays
    
Shuffle arrays to maintain inter-array ordering
Shuffles each array in the list of arrays, arrays_list, such that
the inter-array order is maintained

Parameters

arrays_list : list
List containing each array that will be shuffled
rand_seed : int
The seed to use for shuffling each array
return_seed : bool
If True, will return the seed used to shuffle the arrays (for
reproducibility)
Shuffle arrays to maintain inter - array ordering Shuffles each array in the list of arrays arrays_list such that the inter - array order is maintained Parameters arrays_list : list List containing each array that will be shuffled rand_seed : int The seed to use for shuffling each array return_seed : bool If True will return the seed used to shuffle the arrays ( for reproducibility )
def shuffle_arrays(arrays_list, rand_seed=0, return_seed=False):
    shuffled_arrs = []  
    for array in arrays_list:  
        np.random.seed(rand_seed)  
        if type(array) == list:  
            shuffled_arr = [ii for ii in array]
        else:  
            shuffled_arr = array * np.ones_like(array)
        np.random.shuffle(shuffled_arr)  
        shuffled_arrs.append(shuffled_arr)
    if return_seed:  
        return shuffled_arrs, rand_seed
    else:
        return shuffled_arrs
def shuffle_arrays ( arrays_list , rand_seed = 0 , return_seed = False ) : shuffled_arrs = [ ] for array in arrays_list : np . random . seed ( rand_seed ) if type ( array ) == list : shuffled_arr = [ ii for ii in array ] else : shuffled_arr = array * np . ones_like ( array ) np . random . shuffle ( shuffled_arr ) shuffled_arrs . append ( shuffled_arr ) if return_seed : return shuffled_arrs , rand_seed else : return shuffled_arrs
Shuffle arrays to maintain inter-array ordering
Shuffles each array in the list of arrays, arrays_list, such that
the inter-array order is maintained (i.e., the zeroth element of
the all arrays before shuffling corresponds to the nth element of
all arrays after shuffling)
Shuffle arrays to maintain inter - array ordering Shuffles each array in the list of arrays arrays_list such that the inter - array order is maintained ( i . e . the zeroth element of the all arrays before shuffling corresponds to the nth element of all arrays after shuffling )
"""Shuffle arrays to maintain inter-array ordering

    Shuffles each array in the list of arrays, arrays_list, such that
    the inter-array order is maintained (i.e., the zeroth element of
    the all arrays before shuffling corresponds to the nth element of
    all arrays after shuffling)

    Parameters
    ---------
    arrays_list : list
        List containing each array that will be shuffled
    rand_seed : int
        The seed to use for shuffling each array
    return_seed : bool
        If True, will return the seed used to shuffle the arrays (for
        reproducibility)

    Returns
    -------
    shuffled_arrs : list
        List containing the shuffled arrays
    rand_seed :
        The seed that was used to shuffle the arrays
    """ # Init arr for storing the shuffled arrays
 # For each array in the list
 # Set the seed
 # If the 'array' is actually a list
 # Copy the list into a new var that will be shuffled
 # If the array is an array
 # Make a copy that will be shuffled
 # Shuffle the array
 # Append the shuffled array to the list of shuffled arrays
 # If returning the seed, then do so

List containing the shuffled arrays
List containing the shuffled arrays
list

The seed that was used to shuffle the arrays
The seed that was used to shuffle the arrays
arrays_list
rand_seed
return_seed