#NEWLINE# def singletrial( num_trials , skipstep = 1 ) : #NEWLINE# #INDENT# ' Single-trial cross-validation schema\n\n    Use one trial for training, all others for testing.\n\n    Parameters\n    ----------\n    num_trials : int\n        Total number of trials\n    skipstep : int\n        only use every `skipstep` trial for training\n\n    Returns\n    -------\n    gen : generator object\n        the generator returns tuples (trainset, testset)\n    ' #NEWLINE# for t in range ( 0 , num_trials , skipstep ) : #NEWLINE# #INDENT# trainset = [ t ] #NEWLINE# testset = ( [ i for i in range ( trainset [ 0 ] ) ] + [ i for i in range ( ( testset [ ( - 1 ) ] + 1 ) , num_trials ) ] ) #NEWLINE# testset = sort ( [ ( t % num_trials ) for t in testset ] ) #NEWLINE# ( yield ( trainset , testset ) )