Neural Network from Scratch in Rust banner

Neural Network from Scratch in Rust

2 devlogs
7h 45m 52s

Making a neural network from scratch using rust.

This project uses AI

used chatgpt for debugging.

mattseq

had problems using multilayer networks to approximate a simple quadratic equation. it was really dependent on the range: worked fine from -1 to 1 but terrible from -50 to 50. so i added scalers, specifically StandardScaler. i really didnt like how difficult it was to implement though, namely bc i didnt have methods like mean or sum and i also couldnt really use either of them by axis (like take the mean or sum along the columns). so now im refactoring my entire matrix class to both have that and also support higher order tensors (now that im thinking about it, i should rename it to tensor) which might come in handy later if i try to make CNNs. here’s a picture showing the approach im taking to making dynamic tensors using strides (which i believe pytorch also uses)

Attachment
0
mattseq

sorry for the 6 hr devlog. i wasnt sure how long i would work on this project and if i wanted to put it on flavortown anyway. this is my very first rust project and the main reason im learning rust btw is bc i c/c++ really annoys me. i have the most experience with python and java so i not used to lower level languages like c or rust but after trying C++, i kind of hated it but still wanted to have a lower level language under my belt so i decided to learn rust. i’ve already made a neural net from scratch before but with a lot of help from ai so i tried to use it as little as possible and only for debugging. i’ve actually learned a lot more about NNs bc of this approach, particularly about scalers for normalizing inputs. right now i have basic multilayer networks with relu and mse loss but i hope to expand to more activation functions, loss functions, and maybe even convolutional layers if i can figure out backprop for them.

Attachment
0