#调用查看线性回归的几个属性
# 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. Part 30 AngularJS routeparams example

    Here is what we want to do : When we navigate to /students, the list of student names must be displa ...

  2. [atAGC020E]Encoding Subsets

    令$f_{S}$表示字符串$S$的答案(所有子集的方案数之和),考虑转移: 1.最后是一个字符串,不妨仅考虑最后一个字符,即$f_{S[1,|S|)}$(字符串下标从1开始),特别的,若$S_{|S| ...

  3. [bzoj1113]海报

    ans肯定不会超过n,因为我们可以每一列都放一个矩阵考虑减小答案,肯定是要放横的,也就是让两个高度一样的矩阵同时被消除掉,那么中间不能存在比他们低的矩阵问题即判断一个点之前第一个小于等于它的点是不是等 ...

  4. Semaphore信号量的使用

    package ThreadTest; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; pub ...

  5. Python+selenium之键盘和鼠标事件

  6. .NET E F(Entity Framework)框架 DataBase First 和 Code First 简单用法。

    EF是微软.NET平台官方的ORM(objet-relation mapping),就是一种对象-关系 映射,是将关系数据库种的业务数据用对象的形式表现出来,并通过面向对象的方式讲这些对象组织起来,实 ...

  7. Codeforces 870F - Path(数论+分类讨论+正难则反)

    Codeforces 题目传送门 & 洛谷题目传送门 首先考虑 \(d(u,v)\) 是个什么东西,分情况讨论: \(u\not\perp v\),\(d(u,v)=1\) \(u\perp ...

  8. 4.Reverse Words in a String-Leetcode

    class Solution { public: void reverseWords(string &s) { vector<string> data; string word; ...

  9. UE4 C++工程以Game模式启动

    UE4版本:4.24.3源码编译版本 Windows10 + VS2019环境 UE4 C++工程,默认情况下VS中直接运行是启动Editor模式: 有时为了调试等目的需要以Game模式启动,可以避免 ...

  10. Prometheus概述

    Prometheus是什么 首先, Prometheus 是一款时序(time series) 数据库, 但他的功能却并非支部与 TSDB , 而是一款设计用于进行目标 (Target) 监控的关键组 ...