import math


def data_split(para, raw_data, label_data):
	""" split data into training set and testing set according to training percentage defined in para.

	Args:
	--------
	para: the parameters dictionary
	raw_data: log sequence matrix
	label_data: labels

	Returns:
	--------
	train_data: log sequence matrix for training
	train_labels: labels for training
	testing_data: log sequence matrix for testing/evaluation
	testing_labels: labels for testing/evaluation
	"""

	inst_num, event_num = raw_data.shape
	traing_size = int(math.floor(inst_num * para['training_percent']))
	print('Training size is %d while testing size is %d' % (traing_size, inst_num-traing_size))
	train_data = raw_data[:traing_size]
	train_labels = label_data[:traing_size]
	testing_data = raw_data[traing_size:]
	testing_labels = label_data[traing_size:]
	return train_data, train_labels, testing_data, testing_labels