header = lines[0]
lines = lines[1:]
patients = list(set([x[:x.find("_")] for x in lines]))
random.shuffle(patients)
train_cnt = int(0.82 * len(patients)) // this will became 70% of all data
train_patients = set(patients[:train_cnt])
val_patients = set(patients[train_cnt:])
assert len(train_patients & val_patients) == 0
train_lines = [x for x in lines if x[:x.find("_")] in train_patients]