TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24855 18
Made a simple neural network in C implementing Stochastic Gradient Descent algorithm

Repo: https://github.com/aadityansha06/DL-C/blob/main/stochastic-gradient-descent.c

So I mostly code in C, yesterday I thought of trying doing DL though I never did any course or something on DL, I have basic understanding of what neuron is, what forward propagation means etc... just these basic terms.
Thus I tried to create very small neural network or a single layer neuron which get trained on single dataset to find the optimal weight for it. Like if yre input is 2 and expected output is 4. Thus optimal weight i got was around 4.000002 in 300 epochs

After doing this I tried to do it for multiple dataset like {2,4} {3,9} {4,16} but I wasn't able to do. Thus I asked Ai what's the issue it said that I have implemented Stochastic Gradient Descent algorithm which work for single dataset meanwhile for multiple dataset, I needed to find the gradient for each of the dataset and the it's mean value or something and then optimizing it (today studying about gradient maths tbh on yt )..

The whole reason I'm sharing this because I never knew something like Stochastic Gradient Descent algorithm exist and unknowingly I implemented it rather getting into tutorial hell or something and learnt a lot more other stuff..






https://redd.it/1rynx7r
@r_cpp
GitHub DL-C/stochastic-gradient-descent.c at main · aadityansha06/DL-C Deep-learning practice repo in C. Contribute to aadityansha06/DL-C development by creating an account on GitHub.
More from @r_cpp
  1. Oct 7, 2026Full Meeting C++ 2026 program released https://meetingcpp.com/mcpp/schedule/#2026 https://…
  2. Oct 7, 2026Qt moc now can handle basic C++ modules (Qt 6.12) https://codereview.qt-project.org/c/qt/q…
  3. Oct 7, 2026New to c++ Hello everybody,im new to cpp,and want to learn it,i have some knowledge with C…
  4. Oct 7, 2026Optimizing the Compressed Log Pipeline: https://github.com/Tencent/BqLog/blob/main/docs/Ar…
  5. Oct 7, 2026BqLog 2.6.0: a C++ logging library running on 30M+ devices daily, benchmarked against quil…
  6. Oct 7, 2026BqLog 2.6.0: a C++ logging library running on 30M+ devices daily, benchmarked against quil…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →