多重线性回归 多元线性回归_了解多元线性回归

多重线性回归 多元线性回归

Video Link

影片连结

We have taken a look at Simple Linear Regression in Episode 4.1 where we had one variable x to predict y, but what if now we have multiple variables, not just x, but x1,x2, x3 … to predict y — how would we approach this problem? I hope to explain in this article.

我们看了第4.1集中的简单线性回归,其中我们有一个变量x来预测y ,但是如果现在我们有多个变量,不仅是x,而且还有x1,x2,x3 …来预测y ,我们将如何处理?这个问题? 我希望在本文中进行解释。

简单线性回归回顾 (Simple Linear Regression Recap)

From Episode 4.1 we had our data of temperature and humidity:

从第4.1集开始,我们获得了温度和湿度数据:

Image for post

We plotted our Data, found and found a linear relationship — making linear regression suitable:

我们绘制了数据,发现并找到了线性关系,从而使线性回归适用:

Image for post

We then calculated our regression line:

然后,我们计算了回归线:

Image for post

using gradient descent to find our parameters θ₀ and θ₁.

使用梯度下降找到我们的参数 θ₀和θ₁。

Image for post

We then used the regression line calculated to make predictions for Humidity given any Temperature value.

然后,我们使用计算得出的回归线对给定任何温度值的湿度进行预测。

什么是多元线性回归? (What is Multiple Linear Regression?)

Multiple linear regression takes the exact same concept as simple linear regression but applies it to multiple variables. So instead of just looking at temperature to predict humidity, we can look at other factors such as wind speed or pressure.

多元线性回归采用与简单线性回归完全相同的概念,但将其应用于多个变量。 因此,我们不仅可以查看温度来预测湿度,还可以查看其他因素,例如风速或压力

Image for post

We are still trying to predict Humidity so this remains as y.

我们仍在尝试预测湿度,因此仍为y。

We rename Temperature, Wind Speed and Pressure to 𝑥¹,𝑥² and 𝑥³.

我们将温度,风速和压力重命名为𝑥¹𝑥²𝑥³。

Just as with Simple Linear Regression we must ensure that our variables 𝑥₁,𝑥₂ and 𝑥₃ form a linear relationship with y, if not we will be producing a very inaccurate model.

就像简单线性回归一样,我们必须确保变量𝑥₁,𝑥_2𝑥₃ 与y形成线性关系 ,否则,我们将生成一个非常不准确的模型。

Lets plot each of our variables against Humidity:

让我们针对湿度绘制每个变量:

Image for post
Image for post
Image for post
  • Temperature and Humidity form a strong linear relationship

    温度和湿度形成很强的线性关系

  • Wind Speed and Humidity form a linear relationship

    风速和湿度形成线性关系

  • Pressure and Humidity do not form a linear relationship

    压力和湿度不是线性关系

We therefore can not use Pressure (𝑥³) in our multiple linear regression model.

因此,我们不能在多元线性回归模型中使用压力 (𝑥³)。

绘制数据 (Plotting our Data)

Let’s now plot both Temperature (𝑥¹) and Wind Speed (𝑥²) against Humidity.

现在让我们绘制两个温度(𝑥¹) 以及相对于湿度的风速(𝑥²)。

Image for post

We can see that our data follows a roughly linear relationship, that is we can fit a plane on our data that captures the relationship between Temperature, Wind-speed(𝑥₁, 𝑥₂) and Humidity (y).

我们可以看到我们的数据遵循大致线性关系,也就是说,我们可以在数据上拟合一个平面 ,以捕获温度,风速(𝑥₁,𝑥²)和湿度(y)之间的关系。

Image for post

计算回归模型 (Calculating the Regression Model)

Because we are dealing with more than one 𝑥 variable our linear regression model takes the form:

因为我们要处理多个𝑥变量,所以线性回归模型采用以下形式:

Image for post

Just as with simple linear regression in order to find our parameters θ₀, θ₁ and θ₂ we need to minimise our cost function:

与简单的线性回归一样,为了找到我们的参数θ₀,θ₁和θ2,我们需要最小化成本函数:

Image for post

We do this using the gradient descent algorithm:

我们使用梯度下降算法执行此操作:

Image for post

This algorithm is explained in more detail here

此算法在这里更详细地说明

After running our gradient descent algorithm we find our optimal parameters to be θ₀ = 1.14 , θ₁ = -0.031 and θ₂ =-0.004

运行梯度下降算法后,我们发现最优参数为θ₀= 1.14,θ₁= -0.031和θ2= -0.004

Giving our final regression model:

给出我们的最终回归模型:

Image for post

We can then use this regression model to make predictions for Humidity (ŷ) given any Temperature (𝑥¹) or Wind speed value(𝑥²).

然后,我们可以使用该回归模型对给定温度(𝑥¹)或风速值(𝑥²)的湿度(ŷ)进行预测。

In general models that contain more variables tend to be more accurate since we are incorporating more factors that have an effect on Humidity.

通常,包含更多变量的模型往往更准确,因为我们纳入了更多会影响湿度的因素。

_________________________________________

_________________________________________

潜在问题 (Potential Problems)

When including more and more variables in our model we run into a few problems:

当在模型中包含越来越多的变量时 ,我们会遇到一些问题:

  • For example certain variables may become redundant. E.g look at our regression line above, θ₂ =0.004, multiplying our wind speed (𝑥²) by 0.004 barely changes our predicted value for humidity ŷ, which makes wind speed less useful to use in our model.

    例如,某些变量可能变得多余。 例如,看一下上面的回归线θ2 = 0.004,将我们的风速()²)乘以0.004几乎不会改变我们对湿度predicted的预测值,这使得风速在模型中的用处不大。
  • Another example is the scale of our data, i.e we can expect temperature to have a range of say -10 to 100, but pressure may have a range of 1000 to 1100. Using different scales of data can heavily affect the accuracy of our model.

    另一个例子是我们的数据规模,即我们可以预期温度范围在-10到100之间,但是压力可能在1000到1100之间。使用不同的数据规模会严重影响我们模型的准确性。

How we solve these issues will be covered in future episodes.

我们如何解决这些问题将在以后的章节中介绍。

上一集 - 下一集 (Prev Episode — Next Episode)

如有任何疑问,请留在下面! (If you have any questions please leave them below!)

Image for post

翻译自: https://medium.com/ai-in-plain-english/understanding-multiple-linear-regression-2672c955ec1c

多重线性回归 多元线性回归

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391920.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

tp703n怎么做无线打印服务器,TP-Link TL-WR703N无线路由器无线AP模式怎么设置

TP-Link TL-WR703N无线路由器配置简单,不过对于没有网络基础的用户来说,完成路由器的安装和无线AP模式的设置,仍然有一定的困难,本文学习啦小编主要介绍TP-Link TL-WR703N无线路由器无线AP模式的设置方法!TP-Link TL-WR703N无线路…

unity 克隆_使用Unity开发Portal游戏克隆

unity 克隆Learn game development principles by coding a Portal-like game using Unity and C#. The principles you learn in this lecture from Colton Ogden can apply to any programming language and any game.通过使用Unity和C#编写类似于Portal的游戏来学…

swift基础学习(八)

####1.主要用到的知识点 CAGradientLayer 处理渐变色AVAudioPlayer 音频播放Timer 定时器CABasicAnimation 动画#####2.效果图 ####3.代码 import UIKit import AVFoundationclass ViewController: UIViewController, AVAudioPlayerDelegate {var gradientLayer: CAGradientLay…

pandas之groupby分组与pivot_table透视

一、groupby 类似excel的数据透视表,一般是按照行进行分组,使用方法如下。 df.groupby(byNone, axis0, levelNone, as_indexTrue, sortTrue, group_keysTrue,squeezeFalse, observedFalse, **kwargs) 分组得到的直接结果是一个DataFrameGroupBy对象。 df…

js能否打印服务器端文档,js打印远程服务器文件

js打印远程服务器文件 内容精选换一换对于密码鉴权方式创建的Windows 2012弹性云服务器,使用初始密码以MSTSC方式登录时,登录失败,系统显示“第一次登录之前,你必须更改密码。请更新密码,或者与系统管理员或技术支持联…

spring—JdbcTemplate使用

JdbcTemplate基本使用 01-JdbcTemplate基本使用-概述(了解) JdbcTemplate是spring框架中提供的一个对象,是对原始繁琐的Jdbc API对象的简单封装。spring框架为我们提供了很多的操作模板类。例如:操作关系型数据的JdbcTemplate和HibernateTemplate&…

vanilla_如何在Vanilla JavaScript中操作DOM

vanillaby carlos da costa通过卡洛斯达科斯塔 如何在Vanilla JavaScript中操作DOM (How to manipulate the DOM in Vanilla JavaScript) So you have learned variables, selection structures, and loops. Now it is time to learn about DOM manipulation and to start doi…

NOIP201202寻宝

题目 试题描述传说很遥远的藏宝楼顶层藏着诱人的宝藏。 小明历尽千辛万苦终于找到传说中的这个藏宝楼,藏宝楼的门口竖着一个木板,上面写有几个大字:寻宝说明书。说明书的内容如下:藏宝楼共有N1层,最上面一层是顶层&…

修改UITextField中的placeholder的字体

修改字体颜色: [textField setValue:[UIColor redColor] forKeyPath:"_placeholderLabel.textColor"]; 复制代码 修改字体大小: [textField setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:"_placeholderLabel.font"]; 复…

如何使用Python处理丢失的数据

The complete notebook and required datasets can be found in the git repo here完整的笔记本和所需的数据集可以在git repo中找到 Real-world data often has missing values.实际数据通常缺少值 。 Data can have missing values for a number of reasons such as observ…

MySQL—隔离级别

READ UNCOMMITED(读未提交) 即读取到了正在修改但是却还没有提交的数据,这就会造成数据读取的错误。 READ COMMITED(提交读/不可重复读) 它与READ UNCOMMITED的区别在于,它规定读取的时候读到的数据只能是提交后的数据。 这个级别所带来的问题就是不可…

做虚拟化服务器的配资一致嘛,服务器虚拟化技术在校园网管理中的应用探讨.pdf...

第 卷 第 期 江 苏 建 筑 职 业 技 术 学 院 学 报14 3 Vol.14 曧.3年 月 JOURNAL OF JIANGSU JIANZHU INSTITUTE2014 09 Se .2014p服务器虚拟化技术在校园网管理中的应用探讨,汪小霞 江建( , )健雄职业技术学院 软件与服务外包学院 江苏 太仓 215411: , ,摘 要 高校校园网数据…

aws中部署防火墙_如何在AWS中设置自动部署

aws中部署防火墙by Harry Sauers哈里绍尔斯(Harry Sauers) 如何在AWS中设置自动部署 (How to set up automated deployment in AWS) 设置和配置服务器 (Provisioning and Configuring Servers) 介绍 (Introduction) In this tutorial, you’ll learn how to use Amazon’s AWS…

Runtime的应用

来自&#xff1a;http://www.imlifengfeng.com/blog/?p397 1、快速归档 (id)initWithCoder:(NSCoder *)aDecoder { if (self [super init]) { unsigned int outCount; Ivar * ivars class_copyIvarList([self class], &outCount); for (int i 0; i < outCount; i ) …

使用 VisualVM 进行性能分析及调优

https://www.ibm.com/developerworks/cn/java/j-lo-visualvm/转载于:https://www.cnblogs.com/adolfmc/p/7238893.html

spring—事务控制

编程式事务控制相关对象 PlatformTransactionManager PlatformTransactionManager 接口是 spring 的事务管理器&#xff0c;它里面提供了我们常用的操作事务的方法。注意&#xff1a; PlatformTransactionManager 是接口类型&#xff0c;不同的 Dao 层技术则有不同的实现类 …

为什么印度盛产码农_印度农产品价格的时间序列分析

为什么印度盛产码农Agriculture is at the center of Indian economy and any major change in the sector leads to a multiplier effect on the entire economy. With around 17% contribution to the Gross Domestic Product (GDP), it provides employment to more than 50…

SAP NetWeaver

SAP的新一代企业级服务架构——NetWeaver    SAP NetWeaver是下一代基于服务的平台&#xff0c;它将作为未来所有SAP应用程序的基础。NetWeaver包含了一个门户框架&#xff0c;商业智能和报表&#xff0c;商业流程管理&#xff08;BPM&#xff09;&#xff0c;自主数据管理&a…

NotifyMyFrontEnd 函数背后的数据缓冲区(一)

async.c的 static void NotifyMyFrontEnd(const char *channel, const char *payload, int32 srcPid) 函数中的主要逻辑是这样的&#xff1a;复制代码if (whereToSendOutput DestRemote) { StringInfoData buf; pq_beginmessage(&buf, A); //cursor 为 A pq…

最后期限 软件工程_如何在软件开发的最后期限内实现和平

最后期限 软件工程D E A D L I N E…最后期限… As a developer, this is one of your biggest nightmares or should I say your enemy? Name it whatever you want.作为开发人员&#xff0c;这是您最大的噩梦之一&#xff0c;还是我应该说您的敌人&#xff1f; 随便命名。 …