def getData(X_raw, horizon, train_len, tgts=None, verbose=False):
	
	"""
	Organize data in the original form (num_samples, length_in_time)
	to a form that can be fed directly to RNN.
	"""
	
	if tgts is None:
		tgts = range(len(X_raw))

	X = X_raw.T
	Y = X_raw[tgts].T

	X_train = X[:train_len - horizon]
	Y_train = Y[horizon: train_len]

	X_test = X[train_len - horizon: -horizon]
	Y_test = Y[train_len:]
	
	# Reshape to fit RNN
	# The dimension of RNN input/output is (num_samples, length_in_time, data_dimension)
	X_train = X_train.reshape(1, *X_train.shape)
	Y_train = Y_train.reshape(1, *Y_train.shape)

	X_test = X_test.reshape(1, *X_test.shape)
	Y_test = Y_test.reshape(1, *Y_test.shape)

	if verbose:
		print('Training data: input dim = {}, output dim = {}'.format(X_train.shape, Y_train.shape))
		print('Out-sample data: input dim = {}, output dim = {}'.format(X_test.shape, Y_test.shape))

	return X_train, Y_train, X_test, Y_test