Boston House Price with Scikit-Learn
Boston House Price with Scikit-Learn
Data Description
>>> from sklearn.datasets import load_boston
>>> boston = load_boston()
>>> x, y = boston.data, boston.target
>>> print(x.shape)
(506, 13)
>>> print(y.shape)
(506,)
Regression with Linear Regression Model
# encoding:utf8
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, mean_absolute_error
if __name__ == '__main__':
boston = load_boston()
x, y = boston.data, boston.target
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
model = LinearRegression()
model.fit(x_train, y_train)
y_pred = model.predict(x_test)
print("mse: %f" % mean_squared_error(y_test, y_pred))
print("mae: %f" % mean_absolute_error(y_test, y_pred))
Boston House Price with Scikit-Learn的更多相关文章
- (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...
- scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类 (python代码)
scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import ...
- (原创)(四)机器学习笔记之Scikit Learn的Logistic回归初探
目录 5.3 使用LogisticRegressionCV进行正则化的 Logistic Regression 参数调优 一.Scikit Learn中有关logistics回归函数的介绍 1. 交叉 ...
- Scikit Learn: 在python中机器学习
转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的 ...
- Scikit Learn
Scikit Learn Scikit-Learn简称sklearn,基于 Python 语言的,简单高效的数据挖掘和数据分析工具,建立在 NumPy,SciPy 和 matplotlib 上.
- Linear Regression with Scikit Learn
Before you read This is a demo or practice about how to use Simple-Linear-Regression in scikit-lear ...
- 如何使用scikit—learn处理文本数据
答案在这里:http://www.tuicool.com/articles/U3uiiu http://scikit-learn.org/stable/modules/feature_extracti ...
- Query意图分析:记一次完整的机器学习过程(scikit learn library学习笔记)
所谓学习问题,是指观察由n个样本组成的集合,并根据这些数据来预测未知数据的性质. 学习任务(一个二分类问题): 区分一个普通的互联网检索Query是否具有某个垂直领域的意图.假设现在有一个O2O领域的 ...
- 机器学习框架Scikit Learn的学习
一 安装 安装pip 代码如下:# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=83 ...
随机推荐
- 目录:Matrix Differential Calculus with Applications in Statistics and Econometrics,3rd_[Magnus2019]
目录:Matrix Differential Calculus with Applications in Statistics and Econometrics,3rd_[Magnus2019] Ti ...
- docker中centos7安装ssh服务
来源:https://blog.csdn.net/qq_32969313/article/details/64919735 docker安装好后,自己动手做个自己的docker镜像,首先需要从服务器p ...
- U-boot新手入门,烧写进mini2440
拿到一块开发板,首先就要找到它的资料,当然了,开发板的厂商或者代理商会提供资料,资料里会有你需要的. 比如我的这块mini2440,在友善之臂代理商提供的资料里面,就有我们这篇所需要的 把这个文件夹下 ...
- linux发行版及版本号
1991年8月:Linus Torvalds宣布成立Linux 遵行GPL: Kernel:底层监控程序又叫通用程序,即我们所说的操作系统 Kernel的作用: ...
- Python核心技术与实战——二十|Python的垃圾回收机制
今天要讲的是Python的垃圾回收机制 众所周知,我们现在的计算机都是图灵架构.图灵架构的本质,就是一条无限长的纸带,对应着我们的存储器.随着寄存器.异失性存储器(内存)和永久性存储器(硬盘)的出现, ...
- HTML5日期时间输入类型注意事项(time,date)
原文链接:http://www.webhek.com/post/html5-date.html 1.HTML5规范里只规定date新型input输入类型,并没有规定日历弹出框的实现和样式.所以,各浏览 ...
- java poi
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.a ...
- Java & Mysql 餐饮管理系统 过程心得记录
------------------------------------------Have a Good Day~---------------------------------- 准备国赛和AC ...
- php的流程控制 if elseif swich case for循环
if ......else 最简形式: <?php if (true){ echo "晚上找昌仔训练去";}?> ...
- 10.17小作业 基于TCP开发一款远程CMD程序
基于TCP开发一款远程CMD程序 客户端连接服务器后,可以向服务器发送命令 服务器收到命令后执行,无论执行是否成功,无论执行几遍,都将执行结果返回给客户端 注意: 执行系统指令使用subprocess ...