Hi!
First i wanted to thank you for the effort you put into this project. I'm having issues evaluating even the example you posted (XOR). So i trained the network until the avg Fitness was around 1.5 and the best Fitness = 0 (which should solve all possible xor cases). But when i create a Network using the best genome and run some data through it, it doesn't seem to work. Am i doing something wrong or is there some kind of a bug regarding retrieving the best individual? Here's the code i use for the test:
package main
import (
neat "github.com/jinyeom/neat"
"log"
"math"
)
func main(){
// First, create a new instance of Config from the JSON file created above.
// If there's a file import error, the program will crash.
config, err := neat.NewConfigJSON("config.json")
if err != nil{
log.Fatal(err)
}
neatInst := neat.New(config, neat.XORTest())
neatInst.Run()
log.Printf("Fitness: %f\n", neatInst.Best.Fitness)
nn := neat.NewNeuralNetwork(neatInst.Best)
inputs := make([]float64, 3)
inputs[0] = 1.0 // bias
b := []bool{true,false}
for i := 0; i < len(b); i++{
for j := 0; j < len(b); j++{
a := b[i]
b := b[j]
if a{inputs[1] = 1.0}else{inputs[1] = 0.0}
if b{inputs[2] = 1.0}else{inputs[2] = 0.0}
output, _ := nn.FeedForward(inputs)
log.Printf("%t, %t = %f\n",a,b,output[0])
}
}
}
The output of this is in most cases:
2017/07/01 03:09:31 Fitness: 0.000000
2017/07/01 03:09:31 true, true = 0.000000
2017/07/01 03:09:31 true, false = 0.000000
2017/07/01 03:09:31 false, true = 0.000000
2017/07/01 03:09:31 false, false = 0.000000
But sometimes it also goes for all of it:
2017/07/01 03:22:18 Fitness: 0.000000
2017/07/01 03:22:18 true, true = 1.000000
2017/07/01 03:22:18 true, false = 1.000000
2017/07/01 03:22:18 false, true = 1.000000
2017/07/01 03:22:18 false, false = 1.000000
I'd appreciate your feedback on this issue. Chances are i'm simply too dumb/tired to use it :)
Hi!
First i wanted to thank you for the effort you put into this project. I'm having issues evaluating even the example you posted (XOR). So i trained the network until the avg Fitness was around 1.5 and the best Fitness = 0 (which should solve all possible xor cases). But when i create a Network using the best genome and run some data through it, it doesn't seem to work. Am i doing something wrong or is there some kind of a bug regarding retrieving the best individual? Here's the code i use for the test:
The output of this is in most cases:
2017/07/01 03:09:31 Fitness: 0.000000
2017/07/01 03:09:31 true, true = 0.000000
2017/07/01 03:09:31 true, false = 0.000000
2017/07/01 03:09:31 false, true = 0.000000
2017/07/01 03:09:31 false, false = 0.000000
But sometimes it also goes for all of it:
2017/07/01 03:22:18 Fitness: 0.000000
2017/07/01 03:22:18 true, true = 1.000000
2017/07/01 03:22:18 true, false = 1.000000
2017/07/01 03:22:18 false, true = 1.000000
2017/07/01 03:22:18 false, false = 1.000000
I'd appreciate your feedback on this issue. Chances are i'm simply too dumb/tired to use it :)