updates
This commit is contained in:
parent
3de61b1fa5
commit
e6ec7c041c
2
train.py
2
train.py
|
@ -448,7 +448,7 @@ if __name__ == '__main__':
|
||||||
# Select parent(s)
|
# Select parent(s)
|
||||||
parent = 'single' # parent selection method: 'single' or 'weighted'
|
parent = 'single' # parent selection method: 'single' or 'weighted'
|
||||||
x = np.loadtxt('evolve.txt', ndmin=2)
|
x = np.loadtxt('evolve.txt', ndmin=2)
|
||||||
n = min(3, len(x)) # number of previous results to consider
|
n = min(5, len(x)) # number of previous results to consider
|
||||||
x = x[np.argsort(-fitness(x))][:n] # top n mutations
|
x = x[np.argsort(-fitness(x))][:n] # top n mutations
|
||||||
if parent == 'single' or len(x) == 1:
|
if parent == 'single' or len(x) == 1:
|
||||||
x = x[random.randint(0, n - 1)] # select one of the top n
|
x = x[random.randint(0, n - 1)] # select one of the top n
|
||||||
|
|
Loading…
Reference in New Issue