Comments (18)
No error now. Just a warning (see below) but it doesn't seem to be a problem. Thanks.
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mglearn/plot_pca.py:7: DeprecationWarning: The 'cachedir' parameter has been deprecated in version 0.12 and will be removed in version 0.14.
You provided "cachedir='cache'", use "location='cache'" instead.
memory = Memory(cachedir="cache")
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mglearn/plot_nmf.py:7: DeprecationWarning: The 'cachedir' parameter has been deprecated in version 0.12 and will be removed in version 0.14.
You provided "cachedir='cache'", use "location='cache'" instead.
memory = Memory(cachedir="cache")
from mglearn.
True, it was removed in the last release. I'll fix it!
from mglearn.
ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_12228\2721995799.py in
----> 1 from preamble import *
2 get_ipython().run_line_magic('matplotlib', 'inline')
~...\GitHub\introduction_to_ml_with_python\preamble.py in
3 import numpy as np
4 import matplotlib.pyplot as plt
----> 5 import mglearn
6 from cycler import cycler
7
~...\GitHub\introduction_to_ml_with_python\mglearn_init_.py in
----> 1 from . import plots
2 from . import tools
3 from .plots import cm3, cm2
4 from .tools import discrete_scatter
5 from .plot_helpers import ReBl
~...\GitHub\introduction_to_ml_with_python\mglearn\plots.py in
3 from .plot_animal_tree import plot_animal_tree
4 from .plot_rbf_svm_parameters import plot_svm
----> 5 from .plot_knn_regression import plot_knn_regression
6 from .plot_knn_classification import plot_knn_classification
7 from .plot_2d_separator import plot_2d_classification, plot_2d_separator
~...\GitHub\introduction_to_ml_with_python\mglearn\plot_knn_regression.py in
5 from sklearn.metrics import euclidean_distances
6
----> 7 from .datasets import make_wave
8 from .plot_helpers import cm3
9
~...\GitHub\introduction_to_ml_with_python\mglearn\datasets.py in
3 import os
4 from scipy import signal
----> 5 from sklearn.datasets import load_boston
6 from sklearn.preprocessing import MinMaxScaler, PolynomialFeatures
7 from sklearn.datasets import make_blobs
~\AppData\Roaming\Python\Python39\site-packages\sklearn\datasets_init_.py in getattr(name)
154 """
155 )
--> 156 raise ImportError(msg)
157 try:
158 return globals()[name]
ImportError:
load_boston
has been removed from scikit-learn since version 1.2.
The Boston housing prices dataset has an ethical problem: as
investigated in [1], the authors of this dataset engineered a
non-invertible variable "B" assuming that racial self-segregation had a
positive impact on house prices [2]. Furthermore the goal of the
research that led to the creation of this dataset was to study the
impact of air quality but it did not give adequate demonstration of the
validity of this assumption.
The scikit-learn maintainers therefore strongly discourage the use of
this dataset unless the purpose of the code is to study and educate
about ethical issues in data science and machine learning.
In this special case, you can fetch the dataset from the original
source::
import pandas as pd
import numpy as np
data_url = "http://lib.stat.cmu.edu/datasets/boston"
raw_df = pd.read_csv(data_url, sep="\s+", skiprows=22, header=None)
data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
target = raw_df.values[1::2, 2]
Alternative datasets include the California housing dataset and the
Ames housing dataset. You can load the datasets as follows::
from sklearn.datasets import fetch_california_housing
housing = fetch_california_housing()
for the California housing dataset and::
from sklearn.datasets import fetch_openml
housing = fetch_openml(name="house_prices", as_frame=True)
for the Ames housing dataset.
[1] M Carlisle.
"Racist data destruction?"
https://medium.com/@docintangible/racist-data-destruction-113e3eff54a8
[2] Harrison Jr, David, and Daniel L. Rubinfeld.
"Hedonic housing prices and the demand for clean air."
Journal of environmental economics and management 5.1 (1978): 81-102.
https://www.researchgate.net/publication/4974606_Hedonic_housing_prices_and_the_demand_for_clean_air
from mglearn.
I'm getting the same error message while trying to import dataset from mglearn. Please reply and help fix it. How does load_boston related to other data set in mglearn? What is the solution
from mglearn.
i am already check the six and joblib
these modules satisfied the requirement
from mglearn.
This is not an error, it's a warning, and can be safely ignored.
from mglearn.
It is not warning anymore.
Repos like scikit-learn depreciated six: https://github.com/scikit-learn/scikit-learn/pull/12916/files
>>> import mglearn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/filip/.local/lib/python3.8/site-packages/mglearn/__init__.py", line 1, in <module>
from . import plots
File "/Users/filip/.local/lib/python3.8/site-packages/mglearn/plots.py", line 2, in <module>
from .plot_interactive_tree import plot_tree_progressive, plot_tree_partition
File "/Users/filip/.local/lib/python3.8/site-packages/mglearn/plot_interactive_tree.py", line 6, in <module>
from sklearn.externals.six import StringIO # doctest: +SKIP
ModuleNotFoundError: No module named 'sklearn.externals.six'
from mglearn.
from sklearn.externals.six import StringIO
->
from io import StringIO
I made it work in my repo fork.
from mglearn.
Pushed a fix here and to the notebook repo and to pipy. please let me know if it works.
from mglearn.
Similar error. Not sure if they are connected:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import mglearn
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mglearn/init.py in
----> 1 from . import plots
2 from . import tools
3 from .plots import cm3, cm2
4 from .tools import discrete_scatter
5 from .plot_helpers import ReBl
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mglearn/plots.py in
12 from .plot_tree_nonmonotonous import plot_tree_not_monotone
13 from .plot_scaling import plot_scaling
---> 14 from .plot_pca import plot_pca_illustration, plot_pca_whitening, plot_pca_faces
15 from .plot_decomposition import plot_decomposition
16 from .plot_nmf import plot_nmf_illustration, plot_nmf_faces
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mglearn/plot_pca.py in
3 import numpy as np
4
----> 5 from sklearn.externals.joblib import Memory
6
7 memory = Memory(cachedir="cache")
ModuleNotFoundError: No module named 'sklearn.externals.joblib'
from mglearn.
@gcaldiera thanks for reporting. I'm not sure why I didn't see that when I ran everything yesterday but it's definitely related. I'll look into it!
from mglearn.
A work-around is changing the line to "from joblib import Memory"
from mglearn.
I got this while installing
pip install mglearn
Collecting mglearn
Using cached mglearn-0.1.8.tar.gz (540 kB)
Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (1.18.4)
Requirement already satisfied: matplotlib in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (3.2.1)
Requirement already satisfied: scikit-learn in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (0.23.0)
Requirement already satisfied: pandas in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (1.0.3)
Requirement already satisfied: pillow in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (7.1.2)
Requirement already satisfied: cycler in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (0.10.0)
Requirement already satisfied: imageio in /opt/anaconda3/lib/python3.7/site-packages (from mglearn) (2.8.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib->mglearn) (1.2.0)
Requirement already satisfied: python-dateutil>=2.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib->mglearn) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/anaconda3/lib/python3.7/site-packages (from matplotlib->mglearn) (2.4.7)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/anaconda3/lib/python3.7/site-packages (from scikit-learn->mglearn) (2.0.0)
Requirement already satisfied: scipy>=0.19.1 in /opt/anaconda3/lib/python3.7/site-packages (from scikit-learn->mglearn) (1.4.1)
Requirement already satisfied: joblib>=0.11 in /opt/anaconda3/lib/python3.7/site-packages (from scikit-learn->mglearn) (0.14.1)
Requirement already satisfied: pytz>=2017.2 in /opt/anaconda3/lib/python3.7/site-packages (from pandas->mglearn) (2020.1)
Requirement already satisfied: six in /opt/anaconda3/lib/python3.7/site-packages (from cycler->mglearn) (1.14.0)
Building wheels for collected packages: mglearn
WARNING: Building wheel for mglearn failed: [Errno 13] Permission denied: '/Users/avulaankithgmail.com/Library/Caches/pip/wheels/99'
Failed to build mglearn
Installing collected packages: mglearn
Running setup.py install for mglearn ... done
Successfully installed mglearn-0.1.8
I got this error while running import of mglearn
import mglearn
Traceback (most recent call last):
File "", line 1, in
File "/opt/anaconda3/lib/python3.7/site-packages/mglearn/init.py", line 1, in
from . import plots
File "/opt/anaconda3/lib/python3.7/site-packages/mglearn/plots.py", line 14, in
from .plot_pca import plot_pca_illustration, plot_pca_whitening, plot_pca_faces
File "/opt/anaconda3/lib/python3.7/site-packages/mglearn/plot_pca.py", line 5, in
from sklearn.externals.joblib import Memory
ModuleNotFoundError: No module named 'sklearn.externals.joblib'
from mglearn.
Thanks, can you try upgrading mglearn with pip and see if the error persists?
from mglearn.
Thanks for reporting, not an issue for now, though :)
from mglearn.
seems to be an issue now?
TypeError Traceback (most recent call last)
Input In [80], in
13 import IPython
14 import sklearn
---> 15 import mglearn
17 from pathlib import Path
18 from datetime import datetime
File ~/.local/lib/python3.8/site-packages/mglearn/init.py:1, in
----> 1 from . import plots
2 from . import tools
3 from .plots import cm3, cm2
File ~/.local/lib/python3.8/site-packages/mglearn/plots.py:14, in
12 from .plot_tree_nonmonotonous import plot_tree_not_monotone
13 from .plot_scaling import plot_scaling
---> 14 from .plot_pca import plot_pca_illustration, plot_pca_whitening, plot_pca_faces
15 from .plot_decomposition import plot_decomposition
16 from .plot_nmf import plot_nmf_illustration, plot_nmf_faces
File ~/.local/lib/python3.8/site-packages/mglearn/plot_pca.py:7, in
3 import numpy as np
5 from joblib import Memory
----> 7 memory = Memory(cachedir="cache")
10 def plot_pca_illustration():
11 rnd = np.random.RandomState(5)
TypeError: init() got an unexpected keyword argument 'cachedir'
from mglearn.
I am getting the same error when trying to import mglearn
ImportError:
load_boston
has been removed from scikit-learn since version 1.2.
The Boston housing prices dataset has an ethical problem: as
investigated in [1], the authors of this dataset engineered a
non-invertible variable "B" assuming that racial self-segregation had a
positive impact on house prices [2]. Furthermore the goal of the
research that led to the creation of this dataset was to study the
impact of air quality but it did not give adequate demonstration of the
validity of this assumption.
The scikit-learn maintainers therefore strongly discourage the use of
this dataset unless the purpose of the code is to study and educate
about ethical issues in data science and machine learning.
In this special case, you can fetch the dataset from the original
source::
import pandas as pd
import numpy as np
data_url = "http://lib.stat.cmu.edu/datasets/boston"
raw_df = pd.read_csv(data_url, sep="\s+", skiprows=22, header=None)
data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
target = raw_df.values[1::2, 2]
Alternative datasets include the California housing dataset and the
Ames housing dataset. You can load the datasets as follows::
from sklearn.datasets import fetch_california_housing
housing = fetch_california_housing()
for the California housing dataset and::
from sklearn.datasets import fetch_openml
housing = fetch_openml(name="house_prices", as_frame=True)
for the Ames housing dataset.
[1] M Carlisle.
"Racist data destruction?"
https://medium.com/@docintangible/racist-data-destruction-113e3eff54a8
[2] Harrison Jr, David, and Daniel L. Rubinfeld.
"Hedonic housing prices and the demand for clean air."
Journal of environmental economics and management 5.1 (1978): 81-102.
https://www.researchgate.net/publication/4974606_Hedonic_housing_prices_and_the_demand_for_clean_air
Process finished with exit code 1
from mglearn.
You should be able to upload from pypi now and the error should go away. however, the book has been written with a much older version of scikit-learn, and using the current version might break some of the examples. Really, the book needs to be revised for the current version to work properly with it.
from mglearn.
Related Issues (20)
- Add Tests HOT 1
- ModuleNotFoundError: No module named 'mglearn' HOT 3
- DeprecationWarning: Function make_blobs is deprecated; Please import make_blobs directly from scikit-learn warnings.warn(msg, category=DeprecationWarning) HOT 6
- import mglearn in MacOS for Python 3 (3.7) error HOT 4
- mglearn MacOsx : AttributeError: module 'enum' has no attribute 'IntFlag' HOT 2
- error with plot_animal_tree HOT 3
- Mglearn issue after the latest ubuntu update HOT 2
- Readme File!!! HOT 2
- joblib.Memory no longer supports cachedir argument. HOT 2
- Version Issue HOT 2
- Error importing mglearn because of deprecated scikitlearn package "load_boston" HOT 3
- np.bool is deprecated HOT 1
- issue in accessing mglearn package HOT 2
- mglearn.plots.plot_cross_val_selection() will throw ValueError
- I believe I have reinstalled scipy, but I am still unable to open mglearn. HOT 4
- imread error for MG learn HOT 12
- couldn't able to install mglearn in anaconda nor using pip HOT 2
- display(graphviz.Source('dot_graph')) issues HOT 3
- imread error while importing mglearn HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mglearn.