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 ...
随机推荐
- Java操作FTP,从FTP上读取指定文件,把指定文件上传到FTP
需要添加的依赖 <!-- https://mvnrepository.com/artifact/commons-net/commons-net --> <dependency> ...
- Linux inode 详解
操作系统的文件数据除了实际内容之外,通常含有非常多的属性,例如Linux操作系统的文件权限与文件属性.文件系统通常会将这两部分内容分别存放在inode和block中. inode 和 block 概述 ...
- Gym - 101915D Largest Group 最大团
给你一个二分图 问你最大团为多大 解一:状压DP 解二:二分图最大匹配 二分图的最大团=补图的最大独立集 二分图最大独立集=二分图定点个数-最大匹配 //Hungary #include<bit ...
- python+Appium自动化:logging配置代码分离
配置文件信息log.conf: [loggers]keys=root,simpleExample [logger_root]level=DEBUGhandlers=consoleHandler,fil ...
- mongodb aggregate
$project:修改输入文档的结构.可以用来重命名.增加或删除域,也可以用于创建计算结果以及嵌套文档. $match:用于过滤数据,只输出符合条件的文档.$match使用MongoDB的标准查询操作 ...
- Java & Mysql 餐饮管理系统 过程心得记录
------------------------------------------Have a Good Day~---------------------------------- 准备国赛和AC ...
- IT项目开发流程
项目开发流程: 一.需求分析:相关系统分析员向用户初步了解需求,然后用相关的工具软件列出要开发的系统的大功能模块,每个大功能模块有哪些小功能模块,对于有些需求比较明确相关的界面时,在这一步里面可以初步 ...
- SpringMVC优雅的获取HttpSevletRequest及HttpServletResponse简录
https://cloud.tencent.com/developer/article/1403947 通常情况下,SpringMVC可以通过入参的方式绑定HttpServletRequest和Htt ...
- dlerror和dlclose用法
dlclose() 1. 包含头文件 #include<dlfcn.h> 2. 函数定义 int dlclose(void *handle) dlclose用于关闭指定句柄的动态链接库, ...
- hiho #1485 : hiho字符串(滑动窗口)
#1485 : hiho字符串 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 如果一个字符串恰好包含2个'h'.1个'i'和1个'o',我们就称这个字符串是hiho字符 ...