def listOfFeatures2Matrix(features):
 X = numpy.array([])
 Y = numpy.array([])
 for (i, f) in enumerate(features):
  if (i == 0):
   X = f
   Y = (i * numpy.ones((len(f), 1)))
  else:
   X = numpy.vstack((X, f))
   Y = numpy.append(Y, (i * numpy.ones((len(f), 1))))
 return (X, Y)

def listOfFeatures2Matrix ( features ) : X = numpy . array ( [ ] ) Y = numpy . array ( [ ] ) for ( i , f ) in enumerate ( features ) : if ( i == 0 ) : X = f Y = ( i * numpy . ones ( ( len ( f ) , 1 ) ) ) else : X = numpy . vstack ( ( X , f ) ) Y = numpy . append ( Y , ( i * numpy . ones ( ( len ( f ) , 1 ) ) ) ) return ( X , Y )
listoffeatures2matrix this function takes a list of feature matrices as argument and returns a single concatenated feature matrix and the respective class labels .