Esempio n. 1
0
def create_full_member(data):
    member = Member()
    columns = data.shape[1]
    vectors = []
    for column_index in range(0, columns):
        member.features.append(column_index)
        vectors.append(data[:, column_index])
    member.map = np.column_stack(vectors)
    return member
Esempio n. 2
0
def cross_breed(father, mother, data):
    member = Member()
    features = list(set(mother.features + father.features))
    vectors = []
    for column_index in range(0, len(features)):
        if np.random.randint(0, 2) > 0:
            member.features.append(column_index)
            vectors.append(data[:, column_index])
    member.map = np.column_stack(vectors)
    return member
Esempio n. 3
0
def mutate(source, data):
    member = Member()
    vectors = []
    random = create_new_member(data)
    for column_index in range(0, len(source.features)):
        if np.random.randint(0, 10) > 3:
            member.features.append(column_index)
            vectors.append(data[:, column_index])
    for column_index in range(0, len(random.features)):
        if np.random.randint(0, 10) > 6:
            member.features.append(column_index)
            vectors.append(data[:, column_index])
    member.map = np.column_stack(vectors)
    return member