import random


def dataset_creation(labeled_data):
    """Split labeled data into train and test"""
    one_class = []
    zero_class = []
    for data_point in labeled_data:
        if data_point[2] == 0:
            zero_class.append(data_point)
        else:
            one_class.append(data_point)
    random.shuffle(zero_class)
    random.shuffle(one_class)
    training_data = one_class[:len(one_class) // 2] + zero_class[:len(one_class) // 2]
    test_data = one_class[len(one_class) // 2:] + zero_class[len(one_class) // 2:]
    return training_data, test_data