莫烦python教程学习笔记——线性回归模型的属性
#调用查看线性回归的几个属性
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial """
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
"""
from __future__ import print_function
from sklearn import datasets
from sklearn.linear_model import LinearRegression loaded_data = datasets.load_boston()
data_X = loaded_data.data
data_y = loaded_data.target model = LinearRegression()
model.fit(data_X, data_y) print(model.predict(data_X[:4, :]))
print(model.coef_) #回归系数,即x的系数
print(model.intercept_) #y轴截距,即常数值
print(model.get_params()) #模型参数,例如n_jobs等
print(model.score(data_X, data_y)) # R^2 coefficient of determination 回归模型的分数默认是R^2,当然也可以使用-MSE,即负均方误差
莫烦python教程学习笔记——线性回归模型的属性的更多相关文章
- 莫烦python教程学习笔记——保存模型、加载模型的两种方法
# View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://ww ...
- 莫烦python教程学习笔记——使用波士顿数据集、生成用于回归的数据集
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦python教程学习笔记——利用交叉验证计算模型得分、选择模型参数
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦python教程学习笔记——总结篇
一.机器学习算法分类: 监督学习:提供数据和数据分类标签.--分类.回归 非监督学习:只提供数据,不提供标签. 半监督学习 强化学习:尝试各种手段,自己去适应环境和规则.总结经验利用反馈,不断提高算法 ...
- 莫烦python教程学习笔记——validation_curve用于调参
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦python教程学习笔记——learn_curve曲线用于过拟合问题
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦python教程学习笔记——数据预处理之normalization
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦python教程学习笔记——使用鸢尾花数据集
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...
- 莫烦大大TensorFlow学习笔记(9)----可视化
一.Matplotlib[结果可视化] #import os #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf i ...
随机推荐
- Emmet快速语法—助力HTML/CSS一行代码一个页面
学会之后牛掰的场景如下 我们的目标就是用一行代码=>写下面这样的长长长长的HTML结构来. 如:table>(thead.text>th{手机1}*4)+(tbody.text$*4 ...
- 记一次性能优化的心酸历程【Flask+Gunicorn+pytorch+多进程+线程池,一顿操作猛如虎】
您好,我是码农飞哥,感谢您阅读本文,欢迎一键三连哦. 本文只是记录我优化的心酸历程.无他,唯记录尔.....小伙伴们可围观,可打call,可以私信与我交流. 干货满满,建议收藏,需要用到时常看看. 小 ...
- 简易发号SQL,可用于生成指定前缀自增序列--改进版
使用merge语法实现新增or更新 首先创建表 CREATE TABLE Test.dbo.Increments ( Prefix varchar(50) NOT NULL, [MaxNum ] bi ...
- [bzoj1190]梦幻岛宝珠
根据$2^b$分组,组内处理出g[i][j]表示当容量为$j\cdot 2^{i}$且只能选b=i时最大价值,再组间dp用f[i][j]表示当容量为$j\cdot 2^{i}+(w\&(2^{ ...
- [bzoj1109]堆积木
用f[i]表示前i个数,i必须被贡献的答案,考虑转移,枚举下一个被贡献的数j,那么j需要满足:1.$j<i$:2.$a[j]<a[i]$:3.$a[i]-(i-j+1)\le a[j]$, ...
- [bzoj1853]幸运数字
容易发现幸运数字只有1024个,暴力标记倍数还是会tle的 容斥,即从中任选i个的lcm,复杂度为$o(2^1024)$ 剪枝一:当答案超过1024就不用算了 剪枝二:当某个数是另一个数的倍数时就删掉 ...
- 微服务改造之Openfeign的强化插件
在接触 Spring Cloud 这套框架之前,笔者使用的一直是Dubbo.在转型到Spring Cloud 后,发现了一个很郁闷的问题.Spring Cloud 中的 Openfeign,相比于 D ...
- 使用apt安装docker
使用apt安装docker # 更新数据源 apt-get update # 安装所需依赖 apt-get -y install apt-transport-https ca-certificates ...
- springboot静态工具类bean的注入
工具类中调用数据.但是由于工具类方法一般都写成static,所以直接注入就存在问题. 所以写成了这样: package com.rm.framework.core; import org.spring ...
- 深入理解Redis 数据结构—双链表
在 Redis 数据类型中的列表list,对数据的添加和删除常用的命令有 lpush,rpush,lpop,rpop,其中 l 表示在左侧,r 表示在右侧,可以在左右两侧做添加和删除操作,说明这是一个 ...