Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scores for individuals in score_results are wrong #55

Open
jyotikab opened this issue Sep 18, 2018 · 0 comments
Open

scores for individuals in score_results are wrong #55

jyotikab opened this issue Sep 18, 2018 · 0 comments

Comments

@jyotikab
Copy link

jyotikab commented Sep 18, 2018

Here is the code I use:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant