jainaman224 / Algo_Ds_Notes

A comprehensive resource for learning and implementing algorithms and data structures. This repository includes detailed notes, complexity analysis, and code examples in C++, Java, Python, and more. Ideal for students, professionals, and those preparing for coding interviews.
GNU General Public License v3.0
2.24k stars 2.09k forks source link

Add code for linear regression in C++ #1556

Closed nikochiko closed 4 years ago

nikochiko commented 4 years ago

Currently, only language implemented is Python.

P.S. I would like to work on this.

HardevKhandhar commented 4 years ago

I am a GSSoC'2020 participant. I would like to work on this.

chaithanyarlk commented 4 years ago

I would like to work on this in c++,c,java languages please assign this to me .

nikochiko commented 4 years ago

I'm not working on this project anymore. Feel free to assign someone else.

jainaman224 commented 4 years ago

@chaithanyarlk Implement this in C++.

chaithanyarlk commented 4 years ago

Can I get some Description about the problem like Format of inputs and outputs,also some description about question to get some clarity as there is some ambiguity thanks in advance!

jainaman224 commented 4 years ago

I am unsure about this. Can you give me some idea.

nikochiko commented 4 years ago

Linear Regression in C++ is going to be quite a heavy task. You will need predefined functions to perform like matrix multiplication and other utilities like transposing. Linear Regression can be achieved in two ways:

  1. Using normal equation (a straightforward equation using matrix transpose and multiplication)
  2. Using gradient descent (for simplicity, just consider batch gradient descent)

Reference for 1: https://www.geeksforgeeks.org/ml-normal-equation-in-linear-regression/

For 2, you will need to use some matrix calculus and it would be much more complicated unless you have gradient descent code ready. Mathematical reference: https://towardsdatascience.com/understanding-the-mathematics-behind-gradient-descent-dde5dc9be06e Reference for C++: https://helloacm.com/cc-linear-regression-tutorial-using-gradient-descent/

chaithanyarlk commented 4 years ago

Actually I thought that this was only for 2D linear regression thing.But when I saw some issues which were present in this project I came to know that this was somewhat a different concept having n dimensions which involves matrices so it's difficult task for me at this level I think so could you @jainaman224 please assign me another issue which I have requested yesterday ...