wagenaartje / neataptic

:rocket: Blazing fast neuro-evolution & backpropagation for the browser and Node.js
https://wagenaartje.github.io/neataptic/
Other
1.18k stars 278 forks source link

Local Optimum #120

Open robtarr opened 6 years ago

robtarr commented 6 years ago

I've been working on an AI to play a Mario style game. There is one spot where the computer has to go backwards before he jumps to get past an obstacle.

screen shot 2018-03-05 at 10 52 25 pm

The AI always gets stuck here, and won't back up a step to make the jump. Anybody have any thoughts?

The inputs to the network include a 7*6 grid of the spaces around the player + the specific location of the player in the current tile and has 2 outputs - one for direction, and one for jumping.

I initialize the NEAT network like this:

    const MUTATION_RATE = 0.4;
    const MUTATION_AMOUNT = 2;
    const ELITISM = Math.round(0.1 * popsize);

    this.neat = new Neat(43, 2, null, {
      popsize,
      mutation: methods.mutation.ALL,
      mutationRate: MUTATION_RATE,
      mutationAmount: MUTATION_AMOUNT,
      elitism: ELITISM,
      network: new architect.Random(43, 26, 2)
    });
ghost commented 6 years ago

Do you train the network with all different jump types and jump modes before the network works through the real map ?

robtarr commented 6 years ago

My understanding is that using NEAT, you are not supposed to train the network first. I have thought about it, but I'm not sure what that looks like with the NEAT algorithm.

Can I create a network with trained data and pass that in network: trainedNetwork, instead new architect.Random(43, 26, 2)?

dan-ryan commented 6 years ago

What Pummelchen said. Train on smaller sets of data first.

"Anybody have any thoughts?" Negative points if Mario stops moving might help it do backtracking.

"Can I create a network with trained data and pass that in" Yes.