romspline/helpers.py
def partitions_to_sets(p_label, partitions, sort=True):
  """Split partitions into a validation set (indexed by p_label)
  and the rest into a training set
  
  Input
  -----
    p_label    -- index of partition to use
                  as a validation set
    partitions -- set of partitions containing
                  array indices for validation
                  and training (see K-fold cross-validation)
    sort       -- sort the training set?
                  (default True)
  """
  # Validation set
  validation = partitions[p_label]
  
  # Assemble training set from remaining partitions
  training = []
  for ii, pp in enumerate(partitions):
    if ii != p_label:
      training = np.hstack([training, pp])
  training = np.sort(training)
  
  return  validation, np.asarray(training, dtype='int')
Split partitions into a validation set (indexed by p_label)
  and the rest into a training set
  
  Input
  -----
    p_label    -- index of partition to use
                  as a validation set
    partitions -- set of partitions containing
                  array indices for validation
                  and training (see K-fold cross-validation)
    sort       -- sort the training set?
                  (default True)
  
Split partitions into a validation set (indexed by p_label)
and the rest into a training set

Input


Split partitions into a validation set ( indexed by p_label ) and the rest into a training set Input
def partitions_to_sets(p_label, partitions, sort=True):
  validation = partitions[p_label]
  training = []
  for ii, pp in enumerate(partitions):
    if ii != p_label:
      training = np.hstack([training, pp])
  training = np.sort(training)
  return  validation, np.asarray(training, dtype='int')
def partitions_to_sets ( p_label , partitions , sort = True ) : validation = partitions [ p_label ] training = [ ] for ii , pp in enumerate ( partitions ) : if ii != p_label : training = np . hstack ( [ training , pp ] ) training = np . sort ( training ) return validation , np . asarray ( training , dtype = 'int' )
Split partitions into a validation set (indexed by p_label)
and the rest into a training set
Split partitions into a validation set ( indexed by p_label ) and the rest into a training set
"""Split partitions into a validation set (indexed by p_label)
  and the rest into a training set
  
  Input
  -----
    p_label    -- index of partition to use
                  as a validation set
    partitions -- set of partitions containing
                  array indices for validation
                  and training (see K-fold cross-validation)
    sort       -- sort the training set?
                  (default True)
  """ # Validation set # Assemble training set from remaining partitions
p_label
partitions
sort