<commit_before>import numpy as np
from Manners import Manner2

def BehaviourChanges(population, population_fitness, history, history_fitness, emotion, lower_threshold, upper_threshold, k1, k2, k3, domain):
    lower_bound, upper_bound = domain
    status_best = history[np.argsort(history_fitness)[0]]

    # Select as 'bad population' individuals with emotion index lesser than lower threshold
    bad_population = np.where(emotion < lower_threshold)

    if (len(bad_population[0] > 0)):
        population[bad_population] += np.array([Manner2(individual, status_best, k2) 
                for individual in population[bad_population]])
    <commit_msg>Added behaviour change for average population<commit_after>import numpy as np
from Manners import Manner2, Manner3

def BehaviourChanges(population, population_fitness, history, history_fitness, emotion, lower_threshold, upper_threshold, k1, k2, k3, domain):
    lower_bound, upper_bound = domain
    status_best = history[np.argsort(history_fitness)[0]]

    emotion = np.random.uniform(0.2, 0.8, 20)

    # Select as 'bad population' individuals with emotion index lesser than lower threshold
    bad_population = np.where(emotion < lower_threshold)

    # Select as 'average population' individuals with emotion index between lower and upper thresholds
    average_population = np.where(np.logical_and(emotion >= lower_threshold, emotion < upper_threshold))

    # Perform appropriate change to bad population
    if(len(bad_population[0] > 0)):
        population[bad_population] += np.array([Manner2(individual, status_best, k2) 
                for individual in population[bad_population]])

    # Perform appropriate change to average population
    if(len(average_population[0] > 0)):
        population[average_population] += np.array([Manner3(individual, individual_best, status_best, population, k1, k2, k3) 
                for (individual, individual_best) in zip(population[average_population], history[average_population])])
    
{'fraction_non_alphanumeric': 0.0875, 'fraction_numerical': 0.0155, 'mean_word_length': 4.717142857142857, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '3706629', 'n_tokens_mistral': 591, 'n_tokens_neox': 541, 'n_words': 157}