Pycharm:值太多,无法解压缩

2024-10-02 04:34:36 发布

您现在位置:Python中文网/ 问答频道 /正文

如何解压缩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)

错误: 太多的值无法解压缩


Tags: toselfnonenpzerosrangeskclusters

热门问题