Where to start on creating a simple Neural network (for predicting)?

I want to create a basic Neural network to get started off learning Machine Learning. I don’t want to use someone else’s network I want to create mine from scratch. I need to know where I should start off keeping in mind that I only really know Lua and most tutorials are in C# and Python.

I would like my network to do something simple at first like predicting where a player is going to move next, or what key the player will press next. I have heard networks are actually quite simple so I would like it if you could try and explain in simple terms.

Thanks for the help.

I believe C# and I know Python have frameworks for creating Convolutional Neural Network models. You then have to feed the model as many examples of a particular thing as possible(ALOT) and test out different model weights etc… to improve accuracy. I’d be interested as well in an Lua based framework. In essence all the machine learning stuff boils down to building up a memory of pattern associations.

For example, certain patterns of key presses may be associated with other patterns and if certain patterns were pressed, then we can predict with % of accuracy the next pattern.

I would suggest first learning how to do this with other frameworks, then study that framework and attempt to replicate it in lua. I would imagine the Python frameworks at least have source code you can find and read.

Consider taking a look into this resource.

1 Like

To write a neural network, you first need data. That’s an input, preferably more than one column, and an output, just one item you want to predict. For example, your input might be user input and the output might be player direction. (This is a bad example because we can compute this without a neural net)

Of course, predicting future player inputs is actually going to be very hard, so I’d recommend picking something else.

Anyway, to get started you really need data. If you’re looking for machine learning stuff in general, try looking up genetic learning. This is a method more suited for game development which generates its own data.

3 Likes

I would like to look at reinforcement learning. What I really want to do is create an Machine Learning car.

It would start Driving Randomly at first until it finds a road then I would raycast down from all four wheels and if the Instance is not a road then it will be penalized, but if it is a road then it will be rewarded. The trouble is I do not know how to even start writing this machine learning/Neural network.

Okay. So in that situation, you could possible maintain a record of movements or series of movements performed by a vehicle and the results of those movement patterns. (Just spit balling here). That would provide a memory of successful movement patterns vs failed movement patterns. (possibly starting from a given position). Then have the vehicle choose a movement pattern (given its current position) that has the highest success chance, eventually the vehicle will learn which movement patterns are most successful given a particular starting point. Something along those lines

I do not know how to code that though, that is why I wanted some help creating the basics of a network to do something like that.

In Unity Reinforcement Learning is done via ML-Agents or something, i was wondering if it is possible to create something like ML-Agents?

Hey man, sorry i’m this late to respond, I actually moved off from roblox a few years ago and i’ve spent some good time studying AI/ML. Generally for Roblox, I do not recommend Reinforcement Learning at all, Computation time will be horrible and Roblox will end up giving you errors than results. Reinforcement Learning techniques also generally involve learning tons of college and university mathematical concepts.

Instead, what I want you to do is search up Perceptrons. They are the basics of the basics that will let you quickly understand how AI learns in 5 mins.

After that, what you really should be doing is learning about MLPs (Multi-Layered Perceptrons), a more computationally cost-efficient and generally a better alternative to what you are trying to do. I have tried out both RL and MLPs and to be honest, MLPs are better for your situation, not only can you train them with Genetic Algorithms easily, but you can also manually configure your AI by hand under a few minutes. Yes, the math is that simple and effective.

The equation for a perceptron is essentially this.

ActivationFunction(InputValue * Weight + Bias)

Learning all these topics should be very fast for you. I hope you are able to figure it out and implement it youself like you mentioned. :+1:

Sorry. My library have solved these issues long time ago…

1 Like