def read_data(filename, entriesToProcess): ''' Read data set and return feature matrix X and class Y. X - (entriesToProcess x nfeats) Y - (entriesToProcess) ''' directory =os.getcwd() os.chdir("Data") if (not replace) and os.path.isfile("featureMatrix.npy") and os.path.isfile("prediction.npy") : print('Reading saved data from npy file') X = np.load("featureMatrix.npy") Y = np.load("prediction.npy") else: os.chdir("..") interviews, Y = parseCSV(filename, entriesToProcess) entriesToProcess = Y.shape[0] X = extract_featureMatrix(interviews, Y, no_of_features, replace, lemmatize, lowercase, entriesToProcess) os.chdir("Data") np.save("featureMatrix",X) np.save("prediction", Y) os.chdir("..") return X, Y
def read_data(filename, entriesToProcess): ''' Read data set and return feature matrix X and class Y. X - (entriesToProcess x nfeats) Y - (entriesToProcess) ''' directory = os.getcwd() os.chdir("Data") if (not replace) and os.path.isfile( "featureMatrix.npy") and os.path.isfile("prediction.npy"): print('Reading saved data from npy file') X = np.load("featureMatrix.npy") Y = np.load("prediction.npy") else: os.chdir("..") interviews, Y = parseCSV(filename, entriesToProcess) entriesToProcess = Y.shape[0] X = extract_featureMatrix(interviews, Y, no_of_features, replace, lemmatize, lowercase, entriesToProcess) os.chdir("Data") np.save("featureMatrix", X) np.save("prediction", Y) os.chdir("..") return X, Y
def initialize(filename, entriesToProcess) : parseCSV(filename, entriesToProcess) return x[:noOfTrainingEntries,:], y[:noOfTrainingEntries,:]
def initialize(filename, entriesToProcess) : x ,y = parseCSV(filename, entriesToProcess, noOfFeatures, False) return x[:noOfTrainingEntries,:], y[:noOfTrainingEntries,:]