如何解压缩simulate
函数中的值
def simulate(to_range=None, iterations=None):
e = np.finfo(float).eps
simulated_wk = np.zeros((iterations, self.n_clusters)) + e
simulated_sk = np.zeros((iterations, self.n_clusters)) + e
for i in range(iterations):
self.X = np.random.uniform(0, 1, size=(300, 2))
within_cluster_dists = calculate_wk(self.n_clusters, self.df)
simulated_wk[i] = within_cluster_dists
wks = np.mean(simulated_wk + e, axis=0)
sks = np.std(simulated_sk + e, axis=0) * np.sqrt(1 + 1 / 20)
shifted = np.zeros(to_range)
shifted[1:] = shift
shifted[0] = np.nan
return wks, sks, shifted, simulate()
产生错误的代码:
wks, sks = simulate(simulations, self.Ks)
错误: 太多的值无法解压缩
如果您对其他返回值不感兴趣,您可以这样做
相关问题 更多 >
编程相关推荐