华盛顿大学机器学习基础:案例研究week2
2017-10-21 21:03
330 查看
利用Python学习简单的数据操作
import graphlab sales = graphlab.SFrame('home_data.gl/') #exploring the data for housing sales graphlab.canvas.set_target('ipynb') sales.show(view="Scatter Plot",x="sqft_living",y="price")
#create a simple regression model of sqft_living to price train_data,test_data = sales.random_split(.8,seed =0) #build the regression model sqft_model = graphlab.linear_regression.create(train_data,target="price",features=['sqft_living'])
print(test_data['price'].mean()) print(sqft_model.evaluate(test_data))
# let's show what our predictions look like import matplotlib.pyplot as plt %matplotlib inline plt.plot(test_data['sqft_living'],test_data['price'],'.', test_data['sqft_living'],sqft_model.predict(test_data),'-')
sqft_model.get('coefficients')
# explore other features in the data my_features=['bedrooms','bathrooms','sqft_living','sqft_lot','floors','zipcode'] sales[my_features].show()
sales.show(view='BoxWhisker Plot',x='zipcode',y='price')
# build a regression model with more features my_features_model = graphlab.regression.create(train_data,target='price',features=my_features)
print(sqft_model.evaluate(test_data)) print(my_features_model.evaluate(test_data))
# apply learned models to predict prices of 3 houses house1 = sales[sales['id']=='5309101200']
<img src="rich.jpeg">#这个语句要写在esc+M下才能出现图片
# prediction for a second, fancier house house2 = sales[sales['id']=='1925069082']
相关文章推荐
- Coursera 机器学习课程 机器学习基础:案例研究 证书
- [机器学习入门] 李宏毅机器学习笔记-2 (Regression:Case Study ;回归:案例研究)
- 机器学习入门系列02,Regression 回归:案例研究
- coursera《机器学习》吴恩达-week1-04 线性代数基础
- Coursera | Andrew Ng (02-week-1-1.3)—机器学习基础
- wordpress基础插件开发3-add_action()案例研究
- 机器学习入门系列02-Regression 回归:案例研究
- 课程笔记|吴恩达Coursera机器学习 Week1 笔记-机器学习基础
- 机器学习在行业应用中的案例研究
- 机器学习基础 I
- 第一周(基础知识 + 单变量线性回归)-【机器学习-Coursera Machine Learning-吴恩达】
- 损失函数是机器学习里最基础|:损失函数的作用
- 《HTML5与CCS3网页设计基础》案例1---Pacific Trails Resort
- HAProxy基础及案例演示
- 视觉基础:关于机器视觉、机器学习及人工智能领域
- [置顶] 人工神经网络基础数学研究-卷积
- 机器学习:LDA_数学基础_1:贝叶斯数学_基础
- CSS基础研究(三)-CSS基本样式研究
- 斯坦福机器学习视频笔记 Week3 逻辑回归和正则化 Logistic Regression and Regularization
- android基础:广播BroadCast简单案例