2017-12-30

project checklist

frame the problem

select a performance measure

RMSE:均方误差根
MAE: 平均绝对误差
范数越大对大特征值更有效,会忽略小特征值,但数据正态分布时,RSEM性能更好。

Download and load the data

Take a quick look at the data strucure

data.head()

data.info()
data[‘attribute’].value_counts()
data.describe()
也可以画直方图来了解各个数字型属性的分布
data.hist(bins = 50,figsize=(20,15))

create a test set

random select
from sklearn.model_selection import train_test_split
train_set,test_set = train_test_split(data,test_size = 0.2, random_state = 42)
stratified sampling通过对分组属性进行分层采样划分
from sklearn.model_selection import StratifiedShuffleSplit
spliter = StratifiedShuffleSplit(n_splits = 1,test_size = 0.2,random_state = 42)
for train_index,test_index in spliter.split(data,data[‘category’]):
strat_train_set = data.loc[train_index]
start_test_set = data.loc[test_index]

exploring the data:discover and visualize the data to gain insights

visualizing geographical data
housing.plot(kind = ’scatter’,x= ‘longitude’,y = ‘latitude’ ,alpha = 0.4,s = housing[‘population’]/100,label = ‘population’,c = “median_house_value”,camp = plt.get_cmap(“jet”),colorbar = Ture)
plt.legend()

looking for correlations

corr_mattix = housing.corr()

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • project checklist frame the problem select a performance ...
    陆文斌阅读 206评论 0 0
  • 爱情是什么呢?爱一个人你是如何去面对自己和那个TA,(我爱你)经常挂在嘴边,直到有一天,有心中发出爱的光芒,只是去...
    那一日阅读 105评论 0 0
  • 我用冷漠惩罚我过于单纯的过往 这样的冷漠其实还微微发烫 好像一把靠在角落的旧伞 只有阴雨天才变得繁忙 可它并不悲伤...
    乌荆子阅读 323评论 0 1
  • 第十章 公正的评判一本书 我们学会主动的阅读不会为了已经了解一本书在说什么而停顿下来,必须能评论,提出批评,才算...
    星期六1111阅读 228评论 0 0
  • 排序算法 直接插入排序 基本思想 在要排序的一组数中,假设前面(n-1) [n>=2]个数已经是排好顺序的,现在要...
    忘净空阅读 365评论 0 0