计算norm时, 注意把数据改为float 类型, 否则结果不对!
import numpy.linalg as LA
d = LA.svd(features.toarray(),full_matrices=0,compute_uv=0)
LA.norm(d)
/opt/anaconda3/lib/python3.6/site-packages/numpy/linalg/linalg.py:2168: RuntimeWarning: invalid value encountered in sqrt
原因svd返回float32类型,改为
LA.norm(d.astype(float))