def main(): """ Data import and analysis is performed using the two kernels. The analysis is stored in a text file.""" wb = xl.open_workbook(sys.argv[1]) #retrice dataset from the excel file S = wb.sheet_by_index(0) #dataset sheet allData = DI.get_patient_ts( S, 7, 6) #Convert import data to our format data structure allData = DI.remove_missing_tp( allData, S, 7, 6) #remove missing time points from the time series data normalizeValues(allData) #normalize data kernel = sys.argv[2] #Analysis for TWED kernel if kernel == "twed": Analysis = { } #Pass the key in format "twedt1". Returns the most opimal parameters as a tuple of C,S,acc,Nu and Lambda f = open("analysisTWED.txt", "r+") for i in xrange(6): data = cv.gen_time_split_data(allData, i) #split the time series data key = kernel + "T" + str(i) Analysis[key] = chooseOptimalModel( data, kernel) #perform model selection strToWrite = key + ": " + str(Analysis[key][0]) + " " + str( Analysis[key][1]) + " " + str( Analysis[key][2]) + " " + str( Analysis[key][3]) + " " + str( Analysis[key][4]) + "\n" f.write(strToWrite) f.close() else: #Analysis for GERP kernel Analysis = { } #Pass the key in format "twedt1". Returns the most opimal parameters as a tuple of C,S,acc f = open("analysisGERP.txt", "r+") for i in xrange(6): data = cv.gen_time_split_data(allData, i) key = kernel + "T" + str(i) Analysis[key] = chooseOptimalModel( data, kernel) #perform model selection strToWrite = key + ": " + str(Analysis[key][0]) + " " + str( Analysis[key][1]) + " " + str(Analysis[key][2]) + "\n" f.write(strToWrite) f.close()
def main(): """ Data import and analysis is performed using the two kernels. The analysis is stored in a text file.""" wb = xl.open_workbook(sys.argv[1]) #retrice dataset from the excel file S = wb.sheet_by_index(0) #dataset sheet allData = DI.get_patient_ts(S, 7, 6) #Convert import data to our format data structure allData = DI.remove_missing_tp(allData, S, 7, 6) #remove missing time points from the time series data normalizeValues(allData) #normalize data kernel = sys.argv[2] #Analysis for TWED kernel if kernel == "twed": Analysis = {} #Pass the key in format "twedt1". Returns the most opimal parameters as a tuple of C,S,acc,Nu and Lambda f = open("analysisTWED.txt", "r+") for i in xrange(6): data = cv.gen_time_split_data(allData, i) #split the time series data key = kernel+"T"+str(i) Analysis[key] = chooseOptimalModel(data, kernel) #perform model selection strToWrite = key+": "+str(Analysis[key][0])+" "+str(Analysis[key][1])+" "+str(Analysis[key][2])+" "+str(Analysis[key][3])+" "+str(Analysis[key][4])+"\n" f.write(strToWrite) f.close() else: #Analysis for GERP kernel Analysis = {} #Pass the key in format "twedt1". Returns the most opimal parameters as a tuple of C,S,acc f = open("analysisGERP.txt", "r+") for i in xrange(6): data = cv.gen_time_split_data(allData, i) key = kernel+"T"+str(i) Analysis[key] = chooseOptimalModel(data, kernel) #perform model selection strToWrite = key+": "+str(Analysis[key][0])+" "+str(Analysis[key][1])+" "+str(Analysis[key][2])+"\n" f.write(strToWrite) f.close()
def main(): wb = xl.open_workbook("Dataset_S1.xls") S = wb.sheet_by_index(0) allData = DI.get_patient_ts(S, 7, 6) #for (label, time, patient,ts) in allData: # if(patient == str(1185163.0)): # print ts allData = DI.remove_missing_tp(allData, S, 7, 6) #for (label, time, patient,ts) in allData: #if(patient == str(1185163.0)): #print ts #print allData[0] seg_data = cv.gen_time_split_data(allData, 4, 2, 5) for val in seg_data: (train, test) = val print ("This is new iteration") for(label, time, patient, ts) in train: print label, time, patient, len(ts) print("This is new dataset") for(label, time, patient, ts) in test: print label, time, patient, len(ts)
def main(): wb = xl.open_workbook("Dataset_S1.xls") S = wb.sheet_by_index(0) allData = DI.get_patient_ts(S, 7, 6) #for (label, time, patient,ts) in allData: # if(patient == str(1185163.0)): # print ts allData = DI.remove_missing_tp(allData, S, 7, 6) #for (label, time, patient,ts) in allData: #if(patient == str(1185163.0)): #print ts #print allData[0] seg_data = cv.gen_time_split_data(allData, 4, 2, 5) for val in seg_data: (train, test) = val print("This is new iteration") for (label, time, patient, ts) in train: print label, time, patient, len(ts) print("This is new dataset") for (label, time, patient, ts) in test: print label, time, patient, len(ts)