def compute_criterion(self,y):
self.N=len(y)
#construct matrices
A=np.matrix(self.A)
b=np.matrix(self.b).T
H=np.matrix(self.H)
x=lg.inv(H.T*H)*H.T*y #estimation of x
if self.estimate_sigma2 is True:
r,p=self.A.shape
coef=(self.N-p)/r
den=lg.norm(y-H*x)**2
else:
den=self.sigma2
coef=1
term1=A*x-b
num=term1.T*lg.inv(A*lg.inv(H.T*H)*A.T)*term1
self.criterion=coef*num/den ## See page 274 / 345
评论列表
文章目录