func Fitness(c *ca.CellAuto1D) float64 { c.Run() cm := c.ConfusionMatrix() cba := metrics.CBA(cm) // fmt.Println("CBA: ", cba) return cba }
func FitnessAndQ3(c *ca.CellAuto1D) (float64, float64) { c.Run() cm := c.ConfusionMatrix() cba := metrics.CBA(cm) q3 := metrics.Q3(cm) fmt.Println("CBA: ", cba) fmt.Println("Q3: ", q3) return cba, q3 }
func Fitness(c *ca.CellAuto1D) float64 { c.Run() cm := c.ConfusionMatrix() cba := metrics.CBA(cm) fmt.Println("CBA: ", cba) // p, n, unk := 0, 0, 0 // for i, v := range c.Expected { // if c.Rule.Prm.Hasjoker == false || (c.Rule.Prm.Hasjoker == true && v != c.Rule.Prm.TransitionStates[len(c.Rule.Prm.TransitionStates)-1]) { // if c.Expected[i] == c.End[i] { // p += 1 // } else { // n += 1 // } // } else { // unk += 1 // } // } // fmt.Println("P", p, "N", n, "Unk", unk, "Total", p+n+unk) // return float64(p) / float64(p+n) return cba }