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]

 

posted on 2017-12-17 19:34  zengsf  阅读(7304)  评论(0编辑  收藏  举报

导航