So I made a neural network... How do I use it?
Hello, I just made a neural network from watching a guide, but I'm not quite sure how to implement it into a game, all I want is to have it learn to jump over obstacles, thanks
You can not expect to get an answer to such a complex question by describing your problem with one sentence...
Well theres not much else to say?
And besides, its not a complex question, I am just asking how to implement a neural network into unity
Unfortunately I think he's right - nothing wrong with wanting to learn how to develop a neural network, but it's not the same as learning how to make a sprite move with WASD or something; neural networks are a massively complex field with complicated mathematics behind them, and aren't something even many advanced programmers would feel comfortable doing - it's one of those things people go to university to explicitly study for years. If you're having to ask this question it gives the implication you don't know how the neural network actually works or what it's doing in the first place - so I'd highly suggest you take a course on AI and neural networks, genetic algorithms etc.. and make sure you understand what they're doing logically before you try to implement one yourself!
The problem with your question is that it tells us nothing - how does the neural network work? What guide did you follow, what libraries (if any) did you use? Did you evolve it using a genetic algorithm, how is it trained, have you trained it already? etc.. etc..
Saying "I made a neural network, how do I use it" is like asking "I made a car, why can't I drive it?" - you've given no context and we don't know what car you made, why or how you made it, how it works or what the problem even is.
Hope this helps - nothing wrong with trying to learn, but make sure you can walk before you run!
Answer by Bunny83 · May 08, 2020 at 01:13 AM
Like others have already mentioned your question is way too general. There are countless different neural network designs and concepts out there. Apart from that there are also countless different ways how to actually train or modify the network to get closer to what you actually want it to do. That's actually another big factor: What is your actual use case? If you compare a neural network to a car then the main purpose of a neural network is just a mathematical mapping of some inputs to some outputs. Just like the purpose of a car is to get you from a point A to point B. Of course there are many different nuances how one would use a car but the basic principle is always the same.
If you want to learn more about neural networks I highly recommend the 3Blue1Brown series on neural networks.
Actually setting up a neural network requires specific details on the actual usecase. Like @jmurnanedev said you usually have a fittness function in order to determine how "well" the network behaves. There are many different ways how you can improve a neural network. One is through generational mutation, another one is through back propergation. Both general directions work entirely different and have countless different implementations and aspects to it. So just for example generational mutation is usually done by duplicating the network and applying some small random changes to some random elements and test the result. However such test runs are often grouped into test groups / generations and at the end of a test run you choose the generation that has performed the best. If multiple different goals should be achieved at once it's also possible to try to "breed" two or more networks together by combining them into one network by taking some weight from the first network and some from the other or by calculating the mean between them.
Backpropergation is quite math heavy and depends on the active learning towards a certain goal. So you have to have a large set ot test input where you know the wanted output. So you just run the test input through the network and see what the output is and what the expected output should be. From that you can calculate the error (the difference between the wanted output and the actual output) and slightly adjust all the weights in such a way you get closer to the "correct" output. This process has to be repeated many many times.
If you have a lot of free time I can also recommend to watch the AI series of Computerphile. Though the playlist doesn't seem to include the first videos.
edit
For some reason UA has lost the whole bottom of my answer -.-
Anyways I just had some additional links to the feed forward ANN I wrote a few years ago as well as this question which was about life simulation with an ANN. Note that my implementation is not meant to be fast or performant. It's just a simple straight forward OOP approach.
Your answer
Follow this Question
Related Questions
Enemy raycast detects player only at constant distance 0 Answers
What algorithms might be needed to build AI for a game like American Football in Unity? 1 Answer
A little doubt about creating a Talking BOT that simulates AI, for iOS system using Unity. 0 Answers
How to keep an array of targets in detection radius? 0 Answers
using Navmesh or ML Agent ?! 0 Answers