def predictNewTask(self,new_task_X,new_task_y,pred_X,N_sam=1000):
w_dot_array = self.metropolisHastingsAlgorithm(new_task_X,new_task_y,N_sam)
predictions = []
for x_star in pred_X:
predictions.append(sum([sigmoid(np.dot(w,np.atleast_2d(x_star).T))[0,0] for w in w_dot_array])/float(N_sam))
predictions = [1.0 if p>=0.5 else 0.0 for p in predictions]
return predictions
# Helper function
评论列表
文章目录