日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

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

發(fā)布時(shí)間:2023/11/29 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 多重线性回归 多元线性回归_了解多元线性回归 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

多重線(xiàn)性回歸 多元線(xiàn)性回歸

Video Link

影片連結(jié)

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集中的簡(jiǎn)單線(xiàn)性回歸,其中我們有一個(gè)變量x來(lái)預(yù)測(cè)y ,但是如果現(xiàn)在我們有多個(gè)變量,不僅是x,而且還有x1,x2,x3 …來(lái)預(yù)測(cè)y ,我們將如何處理?這個(gè)問(wèn)題? 我希望在本文中進(jìn)行解釋。

簡(jiǎn)單線(xiàn)性回歸回顧 (Simple Linear Regression Recap)

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

從第4.1集開(kāi)始,我們獲得了溫度和濕度數(shù)據(jù):

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

我們繪制了數(shù)據(jù),發(fā)現(xiàn)并找到了線(xiàn)性關(guān)系,從而使線(xiàn)性回歸適用:

We then calculated our regression line:

然后,我們計(jì)算了回歸線(xiàn):

using gradient descent to find our parameters θ? and θ?.

使用梯度下降找到我們的參數(shù) θ?和θ?。

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

然后,我們使用計(jì)算得出的回歸線(xiàn)對(duì)給定任何溫度值的濕度進(jìn)行預(yù)測(cè)。

什么是多元線(xiàn)性回歸? (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.

多元線(xiàn)性回歸采用與簡(jiǎn)單線(xiàn)性回歸完全相同的概念,但將其應(yīng)用于多個(gè)變量。 因此,我們不僅可以查看溫度來(lái)預(yù)測(cè)濕度,還可以查看其他因素,例如風(fēng)速或壓力

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

我們?nèi)栽趪L試預(yù)測(cè)濕度,因此仍為y。

We rename Temperature, Wind Speed and Pressure to 𝑥1,𝑥2 and 𝑥3.

我們將溫度,風(fēng)速和壓力重命名為𝑥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.

就像簡(jiǎn)單線(xiàn)性回歸一樣,我們必須確保變量𝑥?,𝑥_2𝑥? 與y形成線(xiàn)性關(guān)系 ,否則,我們將生成一個(gè)非常不準(zhǔn)確的模型。

Lets plot each of our variables against Humidity:

讓我們針對(duì)濕度繪制每個(gè)變量:

  • Temperature and Humidity form a strong linear relationship

    溫度和濕度形成很強(qiáng)的線(xiàn)性關(guān)系

  • Wind Speed and Humidity form a linear relationship

    風(fēng)速和濕度形成線(xiàn)性關(guān)系

  • Pressure and Humidity do not form a linear relationship

    壓力和濕度不是線(xiàn)性關(guān)系

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

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

繪制數(shù)據(jù) (Plotting our Data)

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

現(xiàn)在讓我們繪制兩個(gè)溫度(𝑥1) 以及相對(duì)于濕度的風(fēng)速(𝑥2)。

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

我們可以看到我們的數(shù)據(jù)遵循大致線(xiàn)性關(guān)系,也就是說(shuō),我們可以在數(shù)據(jù)上擬合一個(gè)平面 ,以捕獲溫度,風(fēng)速(𝑥?,𝑥2)和濕度(y)之間的關(guān)系。

計(jì)算回歸模型 (Calculating the Regression Model)

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

因?yàn)槲覀円幚矶鄠€(gè)𝑥變量,所以線(xiàn)性回歸模型采用以下形式:

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

與簡(jiǎn)單的線(xiàn)性回歸一樣,為了找到我們的參數(shù)θ?,θ?和θ2,我們需要最小化成本函數(shù):

We do this using the gradient descent algorithm:

我們使用梯度下降算法執(zhí)行此操作:

This algorithm is explained in more detail here

此算法在這里更詳細(xì)地說(shuō)明

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

運(yùn)行梯度下降算法后,我們發(fā)現(xiàn)最優(yōu)參數(shù)為θ?= 1.14,θ?= -0.031和θ2= -0.004

Giving our final regression model:

給出我們的最終回歸模型:

We can then use this regression model to make predictions for Humidity (?) given any Temperature (𝑥1) or Wind speed value(𝑥2).

然后,我們可以使用該回歸模型對(duì)給定溫度(𝑥1)或風(fēng)速值(𝑥2)的濕度(?)進(jìn)行預(yù)測(cè)。

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

通常,包含更多變量的模型往往更準(zhǔn)確,因?yàn)槲覀兗{入了更多會(huì)影響濕度的因素。

_________________________________________

_________________________________________

潛在問(wèn)題 (Potential Problems)

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

當(dāng)在模型中包含越來(lái)越多的變量時(shí) ,我們會(huì)遇到一些問(wèn)題:

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

    例如,某些變量可能變得多余。 例如,看一下上面的回歸線(xiàn)θ2 = 0.004,將我們的風(fēng)速()2)乘以0.004幾乎不會(huì)改變我們對(duì)濕度predicted的預(yù)測(cè)值,這使得風(fēng)速在模型中的用處不大。
  • 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.

    另一個(gè)例子是我們的數(shù)據(jù)規(guī)模,即我們可以預(yù)期溫度范圍在-10到100之間,但是壓力可能在1000到1100之間。使用不同的數(shù)據(jù)規(guī)模會(huì)嚴(yán)重影響我們模型的準(zhǔn)確性。

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

我們?nèi)绾谓鉀Q這些問(wèn)題將在以后的章節(jié)中介紹。

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

如有任何疑問(wèn),請(qǐng)留在下面! (If you have any questions please leave them below!)

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

多重線(xiàn)性回歸 多元線(xiàn)性回歸

總結(jié)

以上是生活随笔為你收集整理的多重线性回归 多元线性回归_了解多元线性回归的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。