Learn to Code via Tutorials on Repl.it

← Back to all posts
Build a Neural Network in Python

Hey guys! I built a simple Neural Network from scratch to learn how they work from a fundamental level. I'd love for you to check out the code and tutorial I wrote. Let me know what you think :)

HappyFakeboulde (218)

The output is too fast

shamdasani (21)

@HappyFakeboulde haha yeah, that's what I love about repl.it!

HappyFakeboulde (218)

@shamdasani I'm saying the output is too fast because that leads to me being unable to properly see any output

CSharpIsGud (199)

@HappyFakeboulde Neural Networks typically have to train allot don't they, complex tasks can take a lot of training before they get it right most of the time

HappyFakeboulde (218)

@CSharpIsGud yes...
(that has nothing to do with the output speed)

HappyFakeboulde (218)

@CaptainAnon frustrated sigh
i don't like forking repls

HappyFakeboulde (218)

@HoldenKirlan_St but sometimes i have to use it, i just want people to reduce how often it must be used

JakobNacanaynay (36)

Great! The only neural network I made (although I don't know if it counts)was a code which tried to find the number zero by adding a list of numbers. https://repl.it/@JakobNacanaynay/Neural-Network-30. It works 50% of the time.You should also give the option to see one at a time using the time package.

shamdasani (21)

@JakobNacanaynay this looks cool, but how exactly does it find zero? Could you explain the theory behind your code? I'm just a bit confused haha :)

JakobNacanaynay (36)

@shamdasani While I don't know if it's neural network, there is a list of numbers from -50 to 50 except zero. At first there is a 50% chance it will be added to the total but, depending on how well it did from last time, the chances will increase or decrease. For example it chooses to add -15,30,5,-50,-30 on the first time adding to -60. The next time it chooses numbers that add to 20. For my code, since it had a lower absolute value by 20, the chance of appearing again changes from 50% to 70%. It is a neural network only with weights.

pauliunas (5)

@JakobNacanaynay Increasing the chance of adding one number to the list will not increase the chance of getting a zero... If you were aiming for something like a sum of 200 from a certain amount of numbers, then yeah, this would work, because higher numbers would get higher priority. But n this case, it's the combination that matters, and individual choices don't affect anything.

hayaodeh (181)

Oh wow this is neat. I'll share it

hayaodeh (181)

@shamdasani you're welcome. we're enhancing repl talk, we'll make it easier to share, so that when someone finds an interesting program they would be able to share it instantly! People loved it on twitter 😎

Squrril (2)

the full tutorial website is broken or something, I can't connect to it longer than a few seconds before the whole page is just a white screen. I had to use the Wayback Machine (web.archive.org) to see it.

Corsaka (0)

This is really cool!