Hello! I am trying to make my own Artificial Neural Network like this guy did here: [Youtube Video][1]
It is in Finnish, so no need to watch.
So, his “brain” code was almost 1000 lines long, and it was pretty hard to add more layers and neurons. So I wanted to make more expandable one.
This is a part of original one
// Inputs / Inputit
private float I1, I2, I3;
// Outputs / Outputit
private float Sum_01, Sum_02;
// Mutation rate / Mutaation määrä
public int mutationRate = 5;
//weights ----------------------------------------------------------------------------
//Input1
float W_I1_L1N1;
float W_I1_L1N2;
float W_I1_L1N3;
float W_I1_L1N4;
float W_I1_L1N5;
And this is mine in works.
// Inputs / Inputit
float[] I = new float[3];
// Outputs / Outputit
float[] Sum_ = new float[2];
// Layer amount / Layereiden määrä
[SerializeField]
private int LayerAmount = 2;
// Neuron count for each layer / Neuroni määrä jokaiselle layerille
[SerializeField]
private int NeuronAmountForEachLayer = 5;
// Mutation rate / Mutaation määrä
[SerializeField]
private int mutationRate = 5;
Now the problem is things like these
void Start(){
// Start generation and mutation / Alkugenerointi ja mutaatio
//Mutaatio Input1
if (Random.Range (0, mutationRate) == 1 || simulationStart == true) {
W_I1_L1N1 = Random.Range (-1.0f, 1.0f);
}
}
And I’d like to use it like this (if it even works as intended)
void Start(){
// Start generation and mutation / Alkugenerointi ja mutaatio
//Mutaatio Input1
if (Random.Range (0, mutationRate) == 1 || simulationStart == true) {
foreach (float i in I) {
foreach(int l in LayerAmount){
foreach(int n in NeuronAmountForEachLayer){
W_I*_L[l]N[n] = Random.Range (-1.0f, 1.0f);*
-
}*
-
}*
-
}*
-
}*
-
}*
( W_I1_L1N1 means Weight of Input 1 to Layer 1’s Neuron 1 )
I basically want to use better way of setting these, than doing it for every single one.
It’s hard to explain ANN.
[1]: - YouTube