Neural Network Library (Obsolete)

I’ve been working hard on some more complicated driving behaviors, but I’ve run into an issue

I’ve added in a system for graphing the accuracy of the network over time. I’ve also changed some color schemes to help visualize how active neurons are.

I’d like to add (or see someone add):

-Back-prop based on multiple datasets, not just 1
-Better visualizations of progress (I added a primitive graph/accuracy function)
-Different shapes of networks. It’s difficult for me to say I want a 5 4 3 2 network when all I can make is 5 4 4 2 since the inner layers don’t have any customization
-Easier support for changing the final activation function (this is huge for data classification)
-Turning on the recurrent variable when creating a network seems to error when trying to visualize

image

After about 5% of the training it’s usually done. There’s a couple of problems with this, as I think neurons are dying regardless of what activation functions I use. I also noticed that when you back-prop you use the results from 1 set of data, but it’s usually better to have 10+ sets of data that have their errors averaged together to prevent over-fitting to some extent.

With some of the functional additions mentioned above I think I can get past this plateau.

4 Likes

How you go for making a self driving mechanism with the api? it seem so complicated. can you please give me a code example

Unfortunately I don’t really have time for updating the module so majorly (I’d much rather just make a new one altogether later) anymore so I won’t be able to make those changes. Honestly, I didn’t even think backward propagation even had a use in time-based AIs like this one. I never thought that you could use it to make an AI mimic a person’s actions, which, on its own, is a very interesting concept!
If someone else is able to decipher the array mess that are these networks (back when I made this I hadn’t yet mastered dictionaries), they can try to add these features. Once I have time again, I’ll gladly make a new module that is preferably OOP based and will allow maximum customization.

4 Likes

I would make something cool with this but I know nothing about NNs.

2 Likes

This is literally the first project involving NNs I worked on, and this is the result.

Amazing library and surprisingly easy to use! Thanks for making this!

10 Likes

Oh wow, nice! How’d you make it detect the walls? With raycasting? Or just using the neural network library?

2 Likes

He most definitely used raycasting. The neural network is only a processor, not a sensor. In order for it to work, you need to give it the needed inputs. Raycasting is a basic and yet very effective input for most of the neural networks you may make.

1 Like

Oh okay, thanks! Me and my friend are trying to make an AI car for our racing game. I have no clue where to start in terms of developing this system. Is there anywhere that you know of where we can find out how to do something like this? I haven’t found really any roblox tutorials on this.

2 Likes

You could raycast in all directions from the cars position (Don’t forget to ignore all the objects in the car, and only raycast forward, backward, left, and right, not up or down), if the front raycast hits something, then you make the AI car steer left or right, to avoid the obstickal (I have garbage spelling :joy:), if the left raycast hits something then try to make the AI car steer right, do the opposite if the right raycast hits something, if the back raycast hits something, then try to make the AI car to move faster / stop moving backwards.

2 Likes

Thanks for the answer. You’re spelling’s fine btw, it happens. :rofl: Do you know of any tutorials on how to make raycasting work with neural networks? I understand the concept, and I could learn them each seperately, but how to put them together is what I’m trying to get. Thanks again.

2 Likes

The approach I made for most of my projects was just to shoot the ray to 8 direction down and up, and normalize the distance from ray’s hit position and the origin to feed in. I had like 16 inputs total just for ai positioning :stuck_out_tongue:

Although its Japanese, this person has good example of using ray to detect the environment of where agent is.

2 Likes

Development on a separate project slowing down so with the spare time and my new OOP implementation I’ll start working on a new NN module that will allow for the creation of extremely flexible networks that would work with any type of neuron and not have to be bound by a layer-based system (just like those typical Q-Learning networks you see on YouTube).
Power of OOP!

3 Likes

Oh cool! Thanks for sharing that.

The main thing I’m trying to figure out is how to make the raycasting work with the neural network. Perhaps there’s something online that talks about this process in roblox?

2 Likes

Will you ever work on a CNN Library?

1 Like

This is what advanced scripting is, taking roblox beyond the normal limits!

1 Like

Probably not because it would be unrealistic for Roblox as we do not yet have a use for such a network, nor can it be really made in the first place due to power limitations.

1 Like

Wow, this is so cool, but I am still trying to understand how to create an AI myself. Just a question, what math is most used in AI’s.

1 Like

This is very interesting, you should consider releasing it to lua as a whole.
I’ve done NN and most of the equations in python but a library of this scale is impressive in lua.

I was wondering on the speed of these calculations, roblox lua isn’t known for being fast but since most of the NN formulas use basic operations with some but not alot of compute heavy operations will it be reasonable to create a nerual model and train it inside of a running game?

1 Like

See This book
For more details but essentially activation, prediction, and propagatation functions.
The math is hard (and subjectively scary) to get at first but it’ll make more and more sense later on.

3 Likes

I’m pretty sure that roblox servers are way more capable of handling tons of operations compared to most of the pc we have lol. I actually have tried implementing the running game-based training for my walking horse / bipedal creature, and it worked out pretty well (except i have to occasionally click the screen to stay in the server :stuck_out_tongue: )

1 Like