def predict_proba(self,X):
'''
return confidences (i.e., p(y_j|x))
(in the multi-dimensional output case, this should be an N x L x K array
but @NOTE/@TODO: this is not the case at the moment! At the moment it is N x L x 2;
For example, in
[[ 0. 1. ]
[ 0. 0.9]
[ 0. 1. ]
[ 0. 1. ]
[ 0. 1. ]
[ 1. 0.9]]
y_j=6 with probability 0.9.
)
'''
N,D = X.shape
Y = zeros((N,self.L,2))
for i in range(N):
V = zeros((self.M,self.L))
for m in range(self.M):
V[m,:] = self.h[m].predict(array([X[i,:]]))
k = mode(V)[0]
Y[i,:,0] = k
Y[i,:,1] = sum(V==k,axis=0)/self.M
return Y
评论列表
文章目录