You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
import evolutionary_search as ev_se
bound_pos = [0,1]
bound_neg = [-1,0]
data = dict()
for i in xrange(2):
if i <=0:
data["param_"+str(i)] = np.arange(bound_pos[0],bound_pos[1], 0.1)
else:
data["param_"+str(i)] = np.arange(bound_neg[0],bound_neg[1], 0.1)
def fit(param_0,param_1):
sum1 = param_0+param_1
return sum1
best_params, best_score, score_results, hist,log = ev_se.maximize(fit,data,args={},verbose=True,generations_number=100)
============================================
output: Best individual is: {'param_1': -0.1000000000000002, 'param_0': 0.90000000000000002}
with fitness: 0.8
============================================
However, when I look for all individuals with fitness 0.8 (there should be none except the best individual) in score_results:
===========================
print score_results
(({'param_0': 0.90000000000000002, 'param_1': -0.90000000000000002},
0.79999999999999982),
({'param_0': 0.0, 'param_1': -0.20000000000000018}, 0.79999999999999982),
({'param_0': 0.90000000000000002, 'param_1': -0.80000000000000004},
0.79999999999999982),
..........................................
=======================================
This is clearly incorrect , because for the 1st individual : {'param_0': 0.90000000000000002, 'param_1': -0.90000000000000002}, the score should be 0.0
The text was updated successfully, but these errors were encountered:
Here is the code I use:
This is clearly incorrect , because for the 1st individual : {'param_0': 0.90000000000000002, 'param_1': -0.90000000000000002}, the score should be 0.0
The text was updated successfully, but these errors were encountered: