Dark Mode

NNetwork

A simple neural network in R as an R6 class object


GitHub Repository

Background

After learning R from a few R tutorials, I decided it was time to learn what machine learning and data science truly was. I had been putting off looking those up because I didn't feel like I was ready. I watched a series on neural networks by 3Blue1Brown on YouTube linked below.

But what is a neural network? | Chapter 1, Deep learning

"Oh, I can do that." I immediately thought to myself.

This video series applied old and familiar concepts of linear algebra and multivariable calculus that I had learned in college. Knowing that there were applications of this with data and programming inspired me to try to write some libraries from scratch.

Trained Neutal Network
My first trained neural network!

The Project

I chose R to do this rather than Python because I wanted to build experience with R. This project would be a good demonstration of mixing higher mathmatics with programming, which is what R was built to do.

I did not follow any programming tutorials when developing this. My primary intention was to familiarize myself with the math behind these concepts. I wrote out as much of the program that made sense to me and then referenced YouTube for more detailed topics as I came to them. I primariliy referenced a series by deeplizard on Neural Networks linked below.

Deep Learning Fundamentals - Intro to Neural Networks

This series was helpful and taught me about weights and bias initialization, the learning rate, and walked the tedious math sequences in a way that I could follow with my code.

One idea I came up with myself was simple testing process to verify the project worked. I decided to test the network by training it to read binary. This way I would not have to find or build a database of training data, nor label the data.

Next Steps

This project was written in December of 2022 and added to GitHub in February of 2023. The next seps I would like to do would be to formalize the testing process into a Unit Test with the testthat library in R. After that, I would like to format the library into a package that could be installed consistently into other machines. Not necesarrily through CRAN, but through GitHub.