Problems importing imblearn python package on ipython notebook

前端 未结 6 652
渐次进展
渐次进展 2021-01-12 19:05

I installed https://github.com/glemaitre/imbalanced-learn on windows powershell using pip install, conda and github. But when I\'m on

相关标签:
6条回答
  • 2021-01-12 19:30

    Type !pip install imblearn

    in jupyter notebook. this worked for me.

    0 讨论(0)
  • 2021-01-12 19:34

    What finally worked for me was putting the venv into the notebook according to Add Virtual Environment to Jupyter Notebook

    Here's what I did, using commands from the article:

    $ python3 -m pip install --user ipykernel
    
    # add the virtual environment to Jupyter
    $ python3 -m ipykernel install --user --name=venv
    
    # create the virtual env in the working directory
    $ python3 -m venv ./venv
    
    # activate the venv
    $ source venv/bin/activate
    
    # install the package
    (venv) pip install imbalanced-learn
    
    # fire up the notebook
    (venv) jupyter notebook
    
    
    0 讨论(0)
  • 2021-01-12 19:34

    pip install -U imbalanced-learn should work, although make sure you've met the dependencies for numpy, scipy and scikit-learn.

    Imbalanced-learn 0.3.0 Install Documentation

    0 讨论(0)
  • 2021-01-12 19:35

    Try this:

    from imblearn import under_sampling, over_sampling
    

    In order to import SMOTE:

    from imblearn.over_sampling import SMOTE
    

    Or datasets:

    from imblearn.datasets import ...
    
    0 讨论(0)
  • 2021-01-12 19:35

    I've tried all of these solutions and nothing worked, only thing that worked for me is changing the kernel. I'm running Jupyter on Amazon Sagemaker and I changed the kernel from pyhton3 to pytorch36 and it worked just fine. Hope this helps

    0 讨论(0)
  • 2021-01-12 19:37

    If it don't work, maybe you need to install "imblearn" package.

    Try to install:

    • pip: pip install -U imbalanced-learn
    • anaconda: conda install -c glemaitre imbalanced-learn

    Then try to import library in your file:

    • from imblearn.over_sampling import SMOTE
    0 讨论(0)
提交回复
热议问题