nord vpnnord vpn
Ad

Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.5 kB
0
Indexable
Never
def load_dataset(data, prefix=''):

   	

	# load all train
	trainX, trainy = load_dataset_group(data, 'train', prefix)
	print(trainX.shape, trainy.shape)
	# load all test
	testX, testy = load_dataset_group(data, 'test', prefix)
	print(testX.shape, testy.shape)
	# zero-offset class values
	trainy = trainy - 1
	testy = testy - 1
	# one hot encode y
	trainy = to_categorical(trainy)
	testy = to_categorical(testy)
  # print("train y here :", trainy)
	print('[samples, time steps, features]',trainX.shape, trainy.shape, '[samples, time steps, features]',testX.shape, testy.shape)
	# trainX.to_csv(root_path + '/train' + '/X_all_train.txt', sep = '\t')
 
	# trainX.to_csv(prefix +'/train/'+ data + '/X_all_train.txt', sep = '\t')
	np.savetxt( prefix +'/train/'+ data + '/X_all_train.txt', trainX.reshape((3,-1)), delimiter = '\t')
  np.savetxt( prefix +'/train/'+ data + '/y_all_train.txt', trainy, delimiter = '\t')
 	# np.savetxt( prefix +'/train/'+ data + '/X_all_train.txt', trainX.reshape((3,-1)), delimiter = '\t')
 	# np.savetxt( prefix +'/train/'+ data + '/X_all_train.txt', trainX.reshape((3,-1)), delimiter = '\t')
 
 
 	# trainy.to_csv(root_path + '/train' + '/y_all_train.txt', sep = '\t')
	# trainy.savetxt(os.mkdir(root_path + '/train' + '/y_all_train.txt', sep = '\t')
  # np.savetxt( root_path + '/train' + '/y_all_train.txt', trainy ,delimiter = '\t')
	# testX.to_csv(prefix +'/test/'+ data + '/X_all_test.txt', sep = '\t')
	# testy.to_csv(root_path + '/test' + '/y_all_test.txt', sep = '\t')
 
	return trainX, trainy, testX, testy

nord vpnnord vpn
Ad