Hi, long time no see,
I am still working on a strongly type genetic programming, I have been having lots of error where the system send numpy.ndarray as argument of a function which is strictly for Boolean value. this raise errors and problems to my search for solution. Right now I give a very bad fitness score to individual with error on them but I would like to avoid them completely as they occupy a large part of the initial individual seed, rendering my GP analysis very unstable.
It is unstable because sometime I begin with 300 good solution and other 200 of them are bad which mean I don't cover the same solution space each run.
pset.addPrimitive(identityo, [object], object)
pset.addPrimitive(identityb, [bool], bool)
pset.addPrimitive(identitya, [numpy.ndarray], numpy.ndarray)
pset.addPrimitive(OR, [bool, bool], bool)
pset.addPrimitive(IF1T, [bool, bool, bool], bool)
pset.addPrimitive(IF1T, [bool, numpy.ndarray, numpy.ndarray], numpy.ndarray)
pset.addPrimitive(add, [numpy.ndarray, numpy.ndarray], numpy.ndarray)
pset.addPrimitive(sub, [numpy.ndarray, numpy.ndarray], numpy.ndarray)
pset.addTerminal(True, bool, "TRUE")
pset.addTerminal(False, bool, "FALSE")
pset.renameArguments(ARG1="day_sunday") #boolean
pset.renameArguments(ARG2="day_monday") #boolean
pset.addPrimitive(sub, [numpy.ndarray, numpy.ndarray], numpy.ndarray)
pset.addTerminal(numpy.array([0,0,0]), numpy.ndarray, "Null")
pset.addTerminal(numpy.array([1,0,0]), numpy.ndarray, "VAL1")
pset.addTerminal(numpy.array([0,1,0]), numpy.ndarray, "VAL2")
pset.addTerminal(numpy.array([0,0,1]), numpy.ndarray, "VAL3")
identityo(OR(sub(Null, Null), day_monday))
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
the problem is Deap sending sub which return numpy.ndarray to OR which takes boolean value only