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 Not Import the EvolutionaryAlgorithmSearchCV Call #37

Open
BernardOng opened this issue Sep 9, 2017 · 3 comments
Open

Can Not Import the EvolutionaryAlgorithmSearchCV Call #37

BernardOng opened this issue Sep 9, 2017 · 3 comments

Comments

@BernardOng
Copy link

BernardOng commented Sep 9, 2017

Using the exact code sample, when I ran the code, I get an import error.

Traceback (most recent call last):
File "test.py", line 18, in
from evolutionary_search import EvolutionaryAlgorithmSearchCV
File "D:\Anaconda2\lib\site-packages\evolutionary_search_init_.py", line 1, in
from .cv import *
File "D:\Anaconda2\lib\site-packages\evolutionary_search\cv.py", line 6, in
from deap import base, creator, tools, algorithms
File "D:\Python\zillow\deap.py", line 25, in
from evolutionary_search import EvolutionaryAlgorithmSearchCV
ImportError: cannot import name EvolutionaryAlgorithmSearchCV

`import sklearn.datasets
import numpy as np
import random

data = sklearn.datasets.load_digits()
X = data["data"]
y = data["target"]

from sklearn.svm import SVC
from sklearn.model_selection import StratifiedKFold

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

random.seed(1)

from evolutionary_search import EvolutionaryAlgorithmSearchCV
cv = EvolutionaryAlgorithmSearchCV(estimator=SVC(),
                                   params=paramgrid,
                                   scoring="accuracy",
                                   cv=StratifiedKFold(n_splits=4),
                                   verbose=1,
                                   population_size=50,
                                   gene_mutation_prob=0.10,
                                   gene_crossover_prob=0.5,
                                   tournament_size=3,
                                   generations_number=5,
                                   n_jobs=4)
cv.fit(X, y)`
@rsteca
Copy link
Owner

rsteca commented Sep 14, 2017

Hi! Many people have reported having problems with this library in an Anaconda environment. How did you install sklearn-deap?

@BernardOng
Copy link
Author

BernardOng commented Sep 14, 2017

I installed per instruction as follows (I used Windows 10 and Anaconda, 2x on main, 3x on env):
pip install sklearn-deap

I just also tried installing from a cloned source under git and it still created the same issue.
I tried under Python v2.7.13 and Python v3.6.2 - same results.
Is there a way around this?

@rsteca
Copy link
Owner

rsteca commented Sep 14, 2017

Maybe you can use a virtualenv environment instead of using anaconda?

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