np.ones(N)/N的作用

在python中导入numpy包

N=5

weights = np.ones(N)/N       //这里就相当于创建了一个数组,且为5个1/5的数组

print "weights", weights

------->weights [0.2 0.2 0.2 0.2 0.2]

原文地址:https://www.cnblogs.com/zengsf/p/8052982.html