Python Forum
How to build linear regression by implementing Gradient Descent using only linear alg
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to build linear regression by implementing Gradient Descent using only linear alg
#1
I'm studying this dataset: https://archive.ics.uci.edu/ml/datasets/...ower+Plant
These are the features:
- AT: Ambiant Temperature
- V: Exhaust Vacuum
- AP: Ambient Pressure
- RH: Relative Humidity
- PE: Energy Output (the label to predict)

We have many parameters such as:
- m: number of observations in the training set
- n: number of features (without the y offset)
- w: the vector of weights of your model (w0, w1, …., wn)
- x: an observation vector (features and offset x0=1 ) . Dimension : (n+1, 1)
- X: matrix of observations. Dimension : (m, n+1)
- y: label (‘answers’) vector . Dimension : (m, 1)
- cost: the cost function J
- delta: the stop condition
- iterations: max number of iterations of the gradient descent (default value = 1000)
- alpha: learning rate of the gradient descent (default value = 0.03)
So I initialize all the vectors first. However, how will I add values inside these vectors? How to do matrix multiplications and the transposed matrix in Python?

w = array([])
x = array([])
X = array([])
y = array([])
I don't really know what to do next.
Reply


Messages In This Thread
How to build linear regression by implementing Gradient Descent using only linear alg - by PythonSpeaker - Dec-01-2019, 04:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple linear regression with interaction summary table Andrzej_Andrzej 0 226 Feb-21-2024, 07:44 AM
Last Post: Andrzej_Andrzej
  How to run a linear model by group in Python? Betty775522 0 515 Oct-18-2023, 07:09 PM
Last Post: Betty775522
  Implementing a Lowpass Filter Madridista 5 2,173 Nov-08-2022, 06:41 PM
Last Post: Madridista
  I get "N/A" labels when implementing object detection hobbyist 0 964 Aug-17-2022, 12:35 PM
Last Post: hobbyist
  General linear model with repeated measures Ziv1279 1 2,533 Dec-20-2020, 11:45 PM
Last Post: PsyPy
  Pulp Linear Programming quest 2 2,327 Nov-10-2020, 09:53 PM
Last Post: quest
  Doubt in Linear Reg by 'MLE' method kumarants 2 1,855 May-08-2020, 12:52 PM
Last Post: kumarants
  Doubt in Linear Reg - "random_state" kumarants 1 1,673 May-05-2020, 06:42 PM
Last Post: buran
  Linear regression doubt - Urgent kumarants 6 3,053 May-05-2020, 04:11 PM
Last Post: kumarants
  How come afer some iterations of gradient descent, the error starts growing? Corpac 0 1,561 Mar-20-2020, 05:20 PM
Last Post: Corpac

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020