Learn practical skills, build real-world projects, and advance your career
Updated 5 years ago
import sklearn.datasets as ds
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
Fetch list of dataSet names
dataSetName = [name for name in dir(ds) if name.startswith("fetch") or name.startswith("load")]
print("Total_DataSets::",len(dataSetName))
print(dataSetName)
Total_DataSets:: 24
['fetch_20newsgroups', 'fetch_20newsgroups_vectorized', 'fetch_california_housing', 'fetch_covtype', 'fetch_kddcup99', 'fetch_lfw_pairs', 'fetch_lfw_people', 'fetch_mldata', 'fetch_olivetti_faces', 'fetch_openml', 'fetch_rcv1', 'fetch_species_distributions', 'load_boston', 'load_breast_cancer', 'load_diabetes', 'load_digits', 'load_files', 'load_iris', 'load_linnerud', 'load_sample_image', 'load_sample_images', 'load_svmlight_file', 'load_svmlight_files', 'load_wine']
Load datasets
for name in dataSetName:
#print(name)
tmp = "ds."+name+"()"
data = eval(tmp)["data"]
print("#"*10 + "Loading..."+ name + "#"*10)
print(name)
print(data)
print("#"*50)
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)
##########Loading...fetch_20newsgroups_vectorized##########
fetch_20newsgroups_vectorized
(0, 5022) 0.017109647770728872
(0, 5886) 0.017109647770728872
(0, 6214) 0.017109647770728872
(0, 6216) 0.017109647770728872
(0, 6281) 0.017109647770728872
(0, 6286) 0.017109647770728872
(0, 6324) 0.017109647770728872
(0, 6331) 0.017109647770728872
(0, 6403) 0.017109647770728872
(0, 11391) 0.017109647770728872
(0, 13930) 0.017109647770728872
(0, 15094) 0.017109647770728872
(0, 15251) 0.017109647770728872
(0, 15530) 0.017109647770728872
(0, 16731) 0.017109647770728872
(0, 20228) 0.017109647770728872
(0, 26214) 0.017109647770728872
(0, 26806) 0.017109647770728872
(0, 27436) 0.017109647770728872
(0, 27618) 0.017109647770728872
(0, 27645) 0.017109647770728872
(0, 27901) 0.017109647770728872
(0, 28012) 0.05132894331218662
(0, 28146) 0.41063154649749295
(0, 28421) 0.034219295541457743
: :
(11313, 115133) 0.035555906726738896
(11313, 115475) 0.4266708807208668
(11313, 115816) 0.035555906726738896
(11313, 118561) 0.035555906726738896
(11313, 118842) 0.1066677201802167
(11313, 118983) 0.07111181345347779
(11313, 119701) 0.035555906726738896
(11313, 119741) 0.035555906726738896
(11313, 121278) 0.1066677201802167
(11313, 121667) 0.07111181345347779
(11313, 121837) 0.035555906726738896
(11313, 121999) 0.035555906726738896
(11313, 123198) 0.035555906726738896
(11313, 123211) 0.035555906726738896
(11313, 123759) 0.035555906726738896
(11313, 123796) 0.035555906726738896
(11313, 124103) 0.035555906726738896
(11313, 124198) 0.035555906726738896
(11313, 124616) 0.07111181345347779
(11313, 125271) 0.035555906726738896
(11313, 128026) 0.035555906726738896
(11313, 128084) 0.035555906726738896
(11313, 128402) 0.1066677201802167
(11313, 128420) 0.035555906726738896
(11313, 128436) 0.035555906726738896
##################################################
##########Loading...fetch_california_housing##########
fetch_california_housing
[[ 8.3252 41. 6.98412698 ... 2.55555556
37.88 -122.23 ]
[ 8.3014 21. 6.23813708 ... 2.10984183
37.86 -122.22 ]
[ 7.2574 52. 8.28813559 ... 2.80225989
37.85 -122.24 ]
...
[ 1.7 17. 5.20554273 ... 2.3256351
39.43 -121.22 ]
[ 1.8672 18. 5.32951289 ... 2.12320917
39.43 -121.32 ]
[ 2.3886 16. 5.25471698 ... 2.61698113
39.37 -121.24 ]]
##################################################
##########Loading...fetch_covtype##########
fetch_covtype
[[2.596e+03 5.100e+01 3.000e+00 ... 0.000e+00 0.000e+00 0.000e+00]
[2.590e+03 5.600e+01 2.000e+00 ... 0.000e+00 0.000e+00 0.000e+00]
[2.804e+03 1.390e+02 9.000e+00 ... 0.000e+00 0.000e+00 0.000e+00]
...
[2.386e+03 1.590e+02 1.700e+01 ... 0.000e+00 0.000e+00 0.000e+00]
[2.384e+03 1.700e+02 1.500e+01 ... 0.000e+00 0.000e+00 0.000e+00]
[2.383e+03 1.650e+02 1.300e+01 ... 0.000e+00 0.000e+00 0.000e+00]]
##################################################
##########Loading...fetch_kddcup99##########
fetch_kddcup99
[[0 b'tcp' b'http' ... 0.0 0.0 0.0]
[0 b'tcp' b'http' ... 0.0 0.0 0.0]
[0 b'tcp' b'http' ... 0.0 0.0 0.0]
...
[0 b'tcp' b'http' ... 0.01 0.0 0.0]
[0 b'tcp' b'http' ... 0.01 0.0 0.0]
[0 b'tcp' b'http' ... 0.01 0.0 0.0]]
##################################################
##########Loading...fetch_lfw_pairs##########
fetch_lfw_pairs
[[ 73.666664 70.666664 81.666664 ... 225.66667 229.66667 233.33333 ]
[ 86.333336 113.333336 133.33333 ... 106. 114.333336 122.333336]
[ 37.333332 35.333332 34. ... 51.333332 52.333332 52. ]
...
[ 73. 94.333336 121.333336 ... 64. 71. 82.333336]
[119. 110.333336 112.666664 ... 145.33333 130. 102.333336]
[ 23.333334 20. 23.333334 ... 146.33333 151. 159. ]]
##################################################
##########Loading...fetch_lfw_people##########
fetch_lfw_people
[[ 34. 29.333334 22.333334 ... 14.666667 16. 14. ]
[158. 160.66667 169.66667 ... 138.66667 135.33333 130.33333 ]
[ 77. 81.333336 88. ... 192. 145.33333 66.333336]
...
[ 38. 41.666668 55.333332 ... 66. 63.666668 54.333332]
[ 16.666666 24.333334 60.333332 ... 219. 143.33333 69.333336]
[ 58.333332 48. 20. ... 116. 106.333336 143.33333 ]]
##################################################
C:\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py:85: DeprecationWarning: Function fetch_mldata is deprecated; fetch_mldata was deprecated in version 0.20 and will be removed in version 0.22. Please use fetch_openml.
warnings.warn(msg, category=DeprecationWarning)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-1da783ca8dba> in <module>
2 #print(name)
3 tmp = "ds."+name+"()"
----> 4 data = eval(tmp)["data"]
5 print("#"*10 + "Loading..."+ name + "#"*10)
6 print(name)
<string> in <module>
C:\Anaconda3\lib\site-packages\sklearn\utils\deprecation.py in wrapped(*args, **kwargs)
84 def wrapped(*args, **kwargs):
85 warnings.warn(msg, category=DeprecationWarning)
---> 86 return fun(*args, **kwargs)
87
88 wrapped.__doc__ = self._update_doc(wrapped.__doc__)
TypeError: fetch_mldata() missing 1 required positional argument: 'dataname'