def normalizeEnc(enc, method):
"""
normalize encoding w. global normalization scheme(s)
parameters:
enc: the encoding vector to normalize
method:
'ssr': signed square root
'l2g': global l2 normalization
"""
# ssr-normalization (kinda hellinger-normalization)
if 'ssr' in method:
enc = np.sign(enc) * np.sqrt(np.abs(enc))
if 'l2g' in method:
enc = preprocessing.normalize(enc)
return enc
评论列表
文章目录