#调用查看线性回归的几个属性
# 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教程学习笔记——线性回归模型的属性的更多相关文章

  1. 莫烦python教程学习笔记——保存模型、加载模型的两种方法

    # View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://ww ...

  2. 莫烦python教程学习笔记——使用波士顿数据集、生成用于回归的数据集

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  3. 莫烦python教程学习笔记——利用交叉验证计算模型得分、选择模型参数

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  4. 莫烦python教程学习笔记——总结篇

    一.机器学习算法分类: 监督学习:提供数据和数据分类标签.--分类.回归 非监督学习:只提供数据,不提供标签. 半监督学习 强化学习:尝试各种手段,自己去适应环境和规则.总结经验利用反馈,不断提高算法 ...

  5. 莫烦python教程学习笔记——validation_curve用于调参

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  6. 莫烦python教程学习笔记——learn_curve曲线用于过拟合问题

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  7. 莫烦python教程学习笔记——数据预处理之normalization

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  8. 莫烦python教程学习笔记——使用鸢尾花数据集

    # View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: ht ...

  9. 莫烦大大TensorFlow学习笔记(9)----可视化

      一.Matplotlib[结果可视化] #import os #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf i ...

随机推荐

  1. Python基础(列表生成式)

    import os; list1 = list(range(1,11)) list2 = [x*x for x in list1 if x % 2 == 0]#列表生成式时,把要生成的元素x * x放 ...

  2. Java String 转成 二位数组

    ... package str; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; impo ...

  3. Java设计模式之(四)——原型模式

    1.什么是原型模式 Specify the kinds of objects to create using a prototypical instance,and create new object ...

  4. python之元编程

    一.什么是元编程 元编程是一种编写计算机程序的技术,这些程序可以将自己看作数据,因此你可以在运行时对它进行内省.生成和/或修改. Python在语言层面对函数.类等基本类型提供了内省及实时创建和修改的 ...

  5. Pacbio三代基因组组装简介

    参考: 视频PPT来自欧易生物讲座:如何开启一个动植物基因组三代de novo项目?

  6. Go 类型强制转换

    Go 类型强制转换 强制类型的语法格式:var a T = (T)(b),使用括号将类型和要转换的变量或表达式的值括起来 强制转换需要满足如下任一条件:(x是非常量类型的变量,T是要转换的类型) 1. ...

  7. Mysql in子查询中加limit报错

    Mysql in子查询中加limit报错 select id from aa where id in ( select id from bb limit 10 ); 改写成 SELECT id FRO ...

  8. 简易kmeans-c++版本

    typedef double dtype; 主要接口: void Kmeans(const vector<vector<dtype> > &d,int k,string ...

  9. Oracle基础入门

    说明:钓鱼君昨天在网上找到一份oracle项目实战的文档,粗略看了一下大致内容,感觉自己很多知识不够扎实,便跟着文档敲了一遍,目前除了机械性代码没有实现外,主要涉及知识:创建表空间.创建用户.给用户赋 ...

  10. Shell 管道指令pipe

    目录 管道命令pipe 选取命令 cut.grep cut 取出需要的信息 grep 取出需要行.过滤不需要的行 排序命令 sort.wc.uniq sort 排序 假设三位数,按十位数从小到大,个位 ...