optimalK.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:gap_statistic 作者: milesgranger 项目源码 文件源码
def _process_with_multiprocessing(self, X: Union[pd.DataFrame, np.ndarray], n_refs: int, cluster_array: np.ndarray):
        """
        Process calling of .calculate_gap() method using the multiprocessing library
        """
        with ProcessPoolExecutor(max_workers=self.n_jobs) as executor:

            jobs = [executor.submit(self._calculate_gap, X, n_refs, n_clusters)
                    for n_clusters in cluster_array
                    ]

            for future in as_completed(jobs):
                gap_value, k = future.result()
                yield (gap_value, k)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号