源码网址
https://github.com/ageron/handson-ml
安装anaconda环境
参考这篇文章或者自己百度
https://www.jianshu.com/p/d3a5ec1d9a08
装相关依赖或者第三方库
pip install pandas
pip install scikit-learn==0.20.3
#使用scikit-learn跑一个两年前的案例, 报错:cannot import name ‘joblib’ from ‘sklearn.externals’
#原因: scikit-learn版本太新了, 回退版本即可
pip install matplotlib
第二章代码解读
import matplotlib.pyplot as plt
housing.hist(bins=50, figsize=(20,15))
bins指bin(箱子)的个数,即每张图柱子的个数
figsize指每张图的尺寸大小
iloc[ : , : ]
前面的冒号就是取行数,后面的冒号是取列数
pd.cut()
的作用,有点类似给成绩设定优良中差,比如:0-59分为差,60-70分为中,71-80分为优秀等等