I am a little confused about the difference between a model and an algorithm. I think linear regression is an algorithm (procedure to fit a straight line) while f_w,b = wx+b is a model. Could someone elaborate? Thanks!
1 Like
Yes, Linear regression is an algorithm that finds a line that best fits a set of data points. The model is the equation that represents the line.
In general, a model is a learned representation of data. An algorithm is used to create this model by finding patterns in the data.
1 Like
In general:
- a model takes an input x and maps it to an output y
- an algorithm is a method or a process that can be defined with certain steps, e.g. like gradient descent. The algorithm can terminate when certain quality criteria is reached, e.g. when an optimum is reached resp. a condition is fulfilled.
My take on that particular question:
- So a linear regression w/ y=f(x) = m x + b is a statistical model since it transforms the input x linearly to the model output y
- More specifically: the way you fit the model when the models parameters are learned can be described with an algorithm, e.g . Gradient descent in the context of linear regression:
Summary:
In my opinion it depends on the context here on what you want to address:
- the fitting process (then the term algorithm is totally fine)
- or if you mean the (parametrized) model that maps an input to an output. Then you better call it just a regression model.
Hope that helps, @mvrbiguv! Please let me know if anything is unclear.
Side note: if you want to check out how linear regression can be solved with the normal equation, this thread might be worth a look.
Best regards
Christian
Got it, this makes sense. Thank you!
1 Like
Sure, you are welcome! Happy learning!
Best regards
Christian