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

Can't get attribute 'Individual' #24

Closed
szymonk92 opened this issue May 3, 2017 · 7 comments
Closed

Can't get attribute 'Individual' #24

szymonk92 opened this issue May 3, 2017 · 7 comments

Comments

@szymonk92
Copy link

szymonk92 commented May 3, 2017

Trying to test example code on Indian Pima Diabetes dataset in Jupyter notebook 5.0.0, Python 3.6, I'm getting an error. Kernel is busy but no processes are running. Turning on debag mode shows:
...
File "c:\users\szymon\anaconda3\envs\tensorflow\lib\multiprocessing\queues.py", line 345, in get return ForkingPickler.loads(res) AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'c:\\users\\szymon\\anaconda3\\envs\\tensorflow\\lib\\site-packages\\deap\\creator.py'> File "c:\users\szymon\anaconda3\envs\tensorflow\lib\multiprocessing\pool.py", line 108, in worker task = get()

@rsteca
Copy link
Owner

rsteca commented May 3, 2017

Can you give me the code you are using? It will be easier to debug that way

@szymonk92
Copy link
Author

szymonk92 commented May 3, 2017

Sure,

### Indian Pima Diabetes  database
names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
dataframe = pd.read_csv('pima-indians-diabetes.data', names=names)

X, X_test, y, y_test = train_test_split(dataframe.iloc[:,:-1],dataframe.iloc[:,-1], 
                                                    test_size = split, 
                                                    random_state = seed)
X = StandardScaler().fit_transform(X)

kfold = KFold(n_splits=10, random_state=42)

paramgrid = {"kernel": ["rbf"],
             "C"     : np.logspace(-9, 9, num=25, base=10),
             "gamma" : np.logspace(-9, 9, num=25, base=10)}


from evolutionary_search import EvolutionaryAlgorithmSearchCV
cv = EvolutionaryAlgorithmSearchCV(estimator=SVC(),
                                   params=paramgrid,
                                   scoring="accuracy",
                                   cv=kfold,
                                   verbose=1,
                                   population_size=50,
                                   gene_mutation_prob=0.10,
                                   gene_crossover_prob=0.5,
                                   tournament_size=3,
                                   generations_number=5,
                                   n_jobs=4)
%time cv.fit(X, y)

cv.best_score_, cv.best_params_

@rsteca
Copy link
Owner

rsteca commented May 4, 2017

I couldn't reproduce the error. Can you tell me which version of the library are you using? also, which version of deap have you installed? I have never tested it using anaconda, can you try it using pip to see if you still have the problem?

@szymonk92
Copy link
Author

szymonk92 commented May 4, 2017

I have no idea how to check sklearn-deap version, but here are some details:

Requirement already satisfied: sklearn-deap in c:\users\szymon\anaconda3\envs\tensorflow\lib\site-packages
Requirement already satisfied: numpy>=1.9.3 in c:\users\szymon\anaconda3\envs\tensorflow\lib\site-packages (from sklearn-deap)
Requirement already satisfied: deap>=1.0.2 in c:\users\szymon\anaconda3\envs\tensorflow\lib\site-packages (from sklearn-deap)
Requirement already satisfied: scikit-learn>=0.18.0 in c:\users\szymon\anaconda3\envs\tensorflow\lib\site-packages (from sklearn-deap)
Requirement already satisfied: scipy>=0.16.0 in c:\users\szymon\anaconda3\envs\tensorflow\lib\site-packages (from sklearn-deap)

I have installed this library using pip on anaconda environment.

Starting search it shows me

Types [1, 2, 2] and maxint [0, 24, 24] detected
--- Evolve in 625 possible combinations ---

and then calculating forever

@sundisktop
Copy link

I had same problem. Seems like it in n_jobs parameter on Windows system. On Linux all works fine

@rsteca
Copy link
Owner

rsteca commented Oct 21, 2017

This should be fixed on version 0.2.2

@rsteca rsteca closed this as completed Oct 21, 2017
@sparo-jack
Copy link

still have the problem
Traceback (most recent call last):
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\pool.py", line 108, in worker
task = get()
File "C:\Users\uesr\Anaconda3\lib\multiprocessing\queues.py", line 337, in get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'Individual' on <module 'deap.creator' from 'C:\Users\uesr\Anaconda3\lib\site-packages\deap\creator.py'>

package version:
deap-1.2.2
sklearn-deap-0.2.2

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

4 participants