多重線性回歸 多元線性回歸_了解多元線性回歸

多重線性回歸 多元線性回歸

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 𝑥1,𝑥2 and 𝑥3.

我們將溫度,風速和壓力重命名為𝑥1𝑥2𝑥3。

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 (𝑥3) in our multiple linear regression model.

因此,我們不能在多元線性回歸模型中使用壓力 (𝑥3)。

繪制數據 (Plotting our Data)

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

現在讓我們繪制兩個溫度(𝑥1) 以及相對于濕度的風速(𝑥2)。

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).

我們可以看到我們的數據遵循大致線性關系,也就是說,我們可以在數據上擬合一個平面 ,以捕獲溫度,風速(𝑥?,𝑥2)和濕度(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 (𝑥1) or Wind speed value(𝑥2).

然后,我們可以使用該回歸模型對給定溫度(𝑥1)或風速值(𝑥2)的濕度(?)進行預測。

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 (𝑥2) by 0.004 barely changes our predicted value for humidity ?, which makes wind speed less useful to use in our model.

    例如,某些變量可能變得多余。 例如,看一下上面的回歸線θ2 = 0.004,將我們的風速()2)乘以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.pswp.cn/news/391920.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/391920.shtml
英文地址,請注明出處:http://en.pswp.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; 隨便命名。 …