我从书中获得了此功能:
def EigenImages( d ):
N,V,H = d.shape
dd = d.astype(float) - d.astype(float).mean(0)
L = np.zeros( (N,N) )
for i in range( N ):
L[i,i] = (dd[i] * dd[i]).sum()
for j in range( i ):
L[i,j] = L[j,i] = (dd[i] * dd[j] ).sum()
evls, evcs = np.linalg.eig( L )
emgs = []
for j in range( N ):
a = np.zeros( (V,H) )
for i in range( N ):
a += evcs[i,j]*dd[i]
emgs.append( a/np.sqrt(evls[j]) )
return emgs, evls
怎么了?