1. numpy load data
def extract_data(filename):
# Arrays to hold the labels and feature vectors.
labels = out[:,2]
labels = labels.reshape(labels.size,1)
fvecs = out[:,3:]
# Return a pair of the feature matrix and the one-hot label matrix.
return fvecs,labels
2.
8 def exec_cmd(cmd):
9 print "====== " + cmd + " ======="
10 status, output = commands.getstatusoutput(cmd)
11 return output