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

pareto archive isn't being updated with islands=True and g=0 #1

Open
weixuanfu opened this issue Jun 1, 2017 · 2 comments
Open

pareto archive isn't being updated with islands=True and g=0 #1

weixuanfu opened this issue Jun 1, 2017 · 2 comments

Comments

@weixuanfu
Copy link

Codes for reproducing the issue:

from ellyn import ellyn
from sklearn.preprocessing import LabelEncoder
from pmlb import fetch_data

problem = 'breast-cancer-wisconsin'
X, y = fetch_data(problem, return_X_y = True)

y = LabelEncoder().fit_transform(y)
learner=ellyn(g=0, popsize=100, selection='tournament', classification=True,
        islands=False, num_islands=8, stop_threshold=0.01, AR=False, tourn_size=3, rt_cross=0.5,
        rt_mut=0.2, verbosity=2, random_state=42, prto_arch_on= True, class_m4gp= True)
learner.fit(X, y)
fitness_score = learner.score(X, y)
print(fitness_score)
learner=ellyn(g=0, popsize=100, selection='tournament', classification=True,
                islands=True, num_islands=8, stop_threshold=0.01, AR=False, tourn_size=3,
                rt_cross=0.5, rt_mut=0.2, verbosity=2, random_state=42,
                prto_arch_on= True, class_m4gp=True)
learner.fit(X, y) # fail with islands=Ture but g==1

Stdout and Stderr

_______________________________________________________________________________
                                    ellenGP
_______________________________________________________________________________
Results Path: /home/weixuanf/AI/ellyn/ellyn
parameter name: ellenGP
data file: d
Settings:
Evolutionary Method: Standard Tournament
ERCs on
Total Population Size: 100
Maximum Generations: 0
Number of log points: 0 (0 means log all points)
fitness type: MSE
verbosity: 2
Number of threads: 48
seeds:
1496330673
2660479011
1025990726
1884380119
1746222507
3630602626
111734222
582074169
1690355396
2910370845
3574735515
3242553180
3186686069
1940247230
194024723
4212676795
1552197784
3048528457
776098892
2078404842
831966003
2466454288
55867111
443916557
388049446
2134271953
3380710792
2992661346
1164148338
3824627349
4156809684
2716346122
3768760238
4018652072
2328296676
1414040172
2522321399
3104395568
1220015449
249891834
637941280
1608064895
1358173061
970123615
3962784961
2854503734
2272429565
3436577903
 number of evals: 100

 Program finished sucessfully.
Storing DistanceClassifier...
final model(s):
        ['x_6', 'x_13']
[best]  ['x_1', 'x_2', '-0.982']
        ['x_7', '0.683', 'x_7', '0.654']
0.88927943761
_______________________________________________________________________________
                                    ellenGP
_______________________________________________________________________________
Results Path: /home/weixuanf/AI/ellyn/ellyn
parameter name: ellenGP
data file: d
Settings:
Evolutionary Method: Standard Tournament
ERCs on
Total Population Size: 100
Maximum Generations: 0
Number of log points: 0 (0 means log all points)
fitness type: MSE
verbosity: 2
Number of threads: 8
seeds:
1496330673
1884380119
3380710792
1690355396
3186686069
388049446
2992661346
194024723
8 islands of 12 individuals, total pop 96
thread 2 exited while loop...
thread 1 exited while loop...
thread 6 exited while loop...
thread 7 exited while loop...
thread 3 exited while loop...
thread 5 exited while loop...
thread 0 exited while loop...
thread 4 exited while loop...
exited parallel region ...

 Program finished sucessfully.
Traceback (most recent call last):
  File "/home/weixuanf/anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
AttributeError: 'list' object has no attribute 'argmax'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "ellyn_islands_tests.py", line 19, in <module>
    learner.fit(X, y) # fail with islands=Ture but g==1
  File "/home/weixuanf/AI/ellyn/ellyn/ellyn.py", line 186, in fit
    self.best_estimator_ = self.hof[np.argmax(self.fit_v)]
  File "/home/weixuanf/anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 963, in argmax
    return _wrapfunc(a, 'argmax', axis=axis, out=out)
  File "/home/weixuanf/anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 67, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/home/weixuanf/anaconda3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 47, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: attempt to get argmax of an empty sequence
@weixuanfu weixuanfu changed the title pareto archive isn't being updated with islands=True pareto archive isn't being updated with islands=True and g=0 Jun 1, 2017
@weixuanfu
Copy link
Author

Another minor issue is about 8 islands of 12 individuals, total pop 96 in stdout, it seems 4 individuals are lost with pop=100

@lacava
Copy link
Member

lacava commented Jun 1, 2017

regarding your second statement, yes: the islands will only divide the set population into equal subpopulations. i'm not sure that's worth changing necessarily.

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

2 participants