def convert_to_num(Ybin, verbose=True):
''' Convert binary targets to numeric vector (typically classification target values)'''
if verbose: print("\tConverting to numeric vector")
Ybin = np.array(Ybin)
if len(Ybin.shape) ==1:
return Ybin
classid=range(Ybin.shape[1])
Ycont = np.dot(Ybin, classid)
if verbose: print Ycont
return Ycont
评论列表
文章目录