<commit_before>hyperplane = []
def train(data, labels):
    #find mean of each label
    #find support vectors
    #calculate hyperplane

    class0 = []
    class1 = []
    mean0 = []
    mean1 = []
    support_vector0 = [] 
    support_vector1 = []

    #calculate mean for each dimension while also populating class list
    for i in range(len(data)):
        if labels[i] == 0:
            class0.append(data[i])
        else:
            class1.append(data[i])
    mean0 = __calculate_mean(class0)
    mean1 = __calculate_mean(class1)
    support_vector0 = __find_supportvecs(class0, mean1)
    support_vector1 = __find_supportvecs(class1, mean0)


def __calculate_mean(classN):
    mean = []
    for i in range(len(classN)):
        mean_i = 0.0
        count = 0.0
        for j in range(len(classN[i]])):
                mean_i += classN[i][j]
                count += 1
        mean.append(mean_i/count)
    return mean

def __find_supportvecs(classN, mean):
    curr_max_dist = 0
    support_vector = []
    for i in range(len(classN)):<commit_msg>dubious math to calculate the hyperplane<commit_after>hyperplane = ()
def train(data, labels):
    #find mean of each label
    #find support vectors
    #calculate hyperplane

    class0 = []
    class1 = []
    mean0 = []
    mean1 = []
    support_vector0 = [] 
    support_vector1 = []

    #calculate mean for each dimension while also populating class list
    for i in range(len(data)):
        if labels[i] == 0:
            class0.append(data[i])
        else:
            class1.append(data[i])
    mean0 = __calculate_mean(class0)
    mean1 = __calculate_mean(class1)
    support_vector0 = __find_supportvecs(class0, mean1)
    support_vector1 = __find_supportvecs(class1, mean0)
    midpoint = [((x+y)/2.0) for x,y in zip(support_vector0, support_vector1)]
    slope = [(x - y) for x,y in zip(support_vector0, support_vector1)]
    inverseslope = [-1/x for x in slope]
    hyperplane = (inverseslope, midpoint)

def __calculate_mean(classN):
    mean = []
    for i in range(len(classN)):
        mean_i = 0.0
        count = 0.0
        for j in range(len(classN[i]])):
                mean_i += classN[i][j]
                count += 1
        mean.append(mean_i/count)
    return mean

def __find_supportvecs(classN, mean):
    curr_max_dist = 0
    support_vector = []
    for i in range(len(classN)):
{'fraction_non_alphanumeric': 0.11078348778433024, 'fraction_numerical': 0.02401010951979781, 'mean_word_length': 2.528974739970282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '167288', 'n_tokens_mistral': 815, 'n_tokens_neox': 795, 'n_words': 192}