scikit-mdr icon indicating copy to clipboard operation
scikit-mdr copied to clipboard

cannot import module BaggingClassifier

Open avilella opened this issue 8 years ago • 3 comments

I tried to install scikit-mdr on an Ubuntu 14.04 Linux via pip install but got this error below. To make sure it wasn't a versions issue with scikit-learn, I did a sudo pip install -U scikit-learn, which completed successfully, then tried to load MDR on a python console. See below.

Any ideas?

Successfully installed scikit-learn
Cleaning up...
avilella@ubuntu14:~$ 
avilella@ubuntu14:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mdr import MDR
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/mdr/__init__.py", line 23, in <module>
    from .mdr_ensemble import MDREnsemble
  File "/usr/local/lib/python2.7/dist-packages/mdr/mdr_ensemble.py", line 26, in <module>
    from sklearn.ensemble import BaggingClassifier
ImportError: cannot import name BaggingClassifier

avilella avatar Aug 23 '17 08:08 avilella

One of the scikit-MDR algorithms uses scikit-learn's BaggingClassifier, which should be available in your installation of scikit-learn.

What version of scikit-learn is installed?

import sklearn
print sklearn.__version__

rhiever avatar Aug 23 '17 16:08 rhiever

avilella@ubuntu14:~$ python Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import sklearn print sklearn.version 0.14.1

On Wed, Aug 23, 2017 at 5:12 PM, Randy Olson [email protected] wrote:

One of the scikit-MDR algorithms uses scikit-learn's BaggingClassifier http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingClassifier.html, which should be available in your installation of scikit-learn.

What version of scikit-learn is installed?

import sklearnprint sklearn.version

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EpistasisLab/scikit-mdr/issues/22#issuecomment-324385469, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJpN3NFkTgdIPd1_E5bXmFVYIEX9Slhks5sbE9jgaJpZM4O_qjU .

avilella avatar Aug 24 '17 10:08 avilella

That explains it. The latest version of scikit-learn is 0.19, and the BaggingClassifier was probably added after 0.14.1.

If you use the Anaconda distribution, I believe they have scikit-learn up-to-date for Python 2.7.

rhiever avatar Aug 24 '17 15:08 rhiever