In python 3
We all know that when the temperature of a metal increases, it begins to expand. So,
we experimented with exposing a metal rod to different temperatures and recorded its
length as follows:
Temp 20 25 30 35 40 45 50 55 60 65
Length 0.5 1.8 5 6 6.2 6.5 7.8 9.4 9.8 10.9
Now do these requirments:
1) Implement and plot a simple linear regression for the above data, where the temperature is “x”, and the length is “y”
2) Implement and plot a multiple linear regression "Polynomial regression" with different degrees.
For example, Degree of 3:
Y = w1x1 + w2x2 + w3x3 + w4
Where w4 represents bias.
*you can use a normal equation to calculate ‘W’ as follow:
W = (XT.X)-1.(XT.Y)
Then calculate Y, Where Y = X.WT
3) Try degrees of 2, 3, 5, and 8
Extracted text: 1. Implement and plot a simple linear regression for the above data, where the temperature is "x", and the length is "y" 2. Implement and plot a multiple linear regression "Polynomial regression" with different degrees. For example, Degree of 3: Y = wix' + w2x? + w3x³ + W4 Where wa represents bias. *you can use normal equation to calculate 'W' as follow: W= (X".X)1.(x".Y) Then calculate Y, Where Y = X.WT 3. Try degree of 2, 3, 5, and 8