def randSplitFeatures(features, partTrain):
 featuresTrain = []
 featuresTest = []
 for (i, f) in enumerate(features):
  [numOfSamples, numOfDims] = f.shape
  randperm = numpy.random.permutation(range(numOfSamples))
  nTrainSamples = int(round((partTrain * numOfSamples)))
  featuresTrain.append(f[randperm[0:nTrainSamples]])
  featuresTest.append(f[randperm[nTrainSamples::None]])
 return (featuresTrain, featuresTest)

def randSplitFeatures ( features , partTrain ) : featuresTrain = [ ] featuresTest = [ ] for ( i , f ) in enumerate ( features ) : [ numOfSamples , numOfDims ] = f . shape randperm = numpy . random . permutation ( range ( numOfSamples ) ) nTrainSamples = int ( round ( ( partTrain * numOfSamples ) ) ) featuresTrain . append ( f [ randperm [ 0 : nTrainSamples ] ] ) featuresTest . append ( f [ randperm [ nTrainSamples : : None ] ] ) return ( featuresTrain , featuresTest )
def randsplitfeatures: this function splits a feature set for training and testing .