I am trying geppy to fit N 3X3 tensor Bij with two scalar list I1,I2 of size N and two 3X3 tensor list V1,V2 with fitness defined as tensorDot(Bij, PBij)/(tensordot(Bij,Bji)*tensordot(PBij, PBji)). but I get errors in my evaluation function like this:
[[ATraceback (most recent call last):
File "testGEPPY_DNS.py", line 109, in
stats=stats, hall_of_fame=hof, verbose=True)
File "/Users/weizhang/software/backup/geppy-master/geppy/algorithms/basic.py", line 100, in gep_simple
for ind, fit in zip(invalid_individuals, fitnesses):
File "testGEPPY_DNS.py", line 71, in evaluate
Rp_i=np.array([[Yp[i,1],Yp[i,2],Yp[i,3]],[Yp[i,2],Yp[i,4],Yp[i,5]],[Yp[i,3],Yp[i,5],Yp[i,:6]]])
IndexError: too many indices for array
here is my evaluation function:
`def evaluate(individual):
"""Evalute the fitness of an individual: MSE (mean squared error)"""
func = toolbox.compile(individual)
Yp = np.array(list(map(func,T1,T2,T3))) # predictions with the GEP model
#print (np.shape(Yp),Yp)
a=0
b=0
c=0
for i in range(size):
Ri=np.array([[bij[i,1],bij[i,2],bij[i,3]],[bij[i,2],bij[i,4],bij[i,5]],[bij[i,3],bij[i,5],bij[i,:6]]])
Rp_i=np.array([[Yp[i,1],Yp[i,2],Yp[i,3]],[Yp[i,2],Yp[i,4],Yp[i,5]],[Yp[i,3],Yp[i,5],Yp[i,:6]]])
# print (Ri,np.shape(Ri))
a=a+np.tensordot(Rp_i,Ri)
b=a+np.tensordot(Ri,Ri.T)
c=c+np.tensordot(Rp_i,Rp_i.T)
return a/(b*c),
`
I tried print the PB, seems give me a array of(N,1) rather than expected (N,3,3)
can you please give me some suggestion
Hello Again Gao & Joach
I am trying geppy to fit N 3X3 tensor Bij with two scalar list I1,I2 of size N and two 3X3 tensor list V1,V2 with fitness defined as tensorDot(Bij, PBij)/(tensordot(Bij,Bji)*tensordot(PBij, PBji)). but I get errors in my evaluation function like this: [[ATraceback (most recent call last): File "testGEPPY_DNS.py", line 109, in stats=stats, hall_of_fame=hof, verbose=True) File "/Users/weizhang/software/backup/geppy-master/geppy/algorithms/basic.py", line 100, in gep_simple for ind, fit in zip(invalid_individuals, fitnesses): File "testGEPPY_DNS.py", line 71, in evaluate Rp_i=np.array([[Yp[i,1],Yp[i,2],Yp[i,3]],[Yp[i,2],Yp[i,4],Yp[i,5]],[Yp[i,3],Yp[i,5],Yp[i,:6]]]) IndexError: too many indices for array
here is my evaluation function: `def evaluate(individual): """Evalute the fitness of an individual: MSE (mean squared error)""" func = toolbox.compile(individual) Yp = np.array(list(map(func,T1,T2,T3))) # predictions with the GEP model
`
I tried print the PB, seems give me a array of(N,1) rather than expected (N,3,3) can you please give me some suggestion