estimator_suite_spark.py 文件源码

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

项目:skggm 作者: skggm 项目源码 文件源码
def _count_support_diff(m, m_hat):
    n_features, _ = m.shape

    m_no_diag = m.copy()
    m_no_diag[np.diag_indices(n_features)] = 0
    m_hat_no_diag = m_hat.copy()
    m_hat_no_diag[np.diag_indices(n_features)] = 0

    m_nnz = len(np.nonzero(m_no_diag.flat)[0])
    m_hat_nnz = len(np.nonzero(m_hat_no_diag.flat)[0])

    nnz_intersect = len(np.intersect1d(np.nonzero(m_no_diag.flat)[0],
                                       np.nonzero(m_hat_no_diag.flat)[0]))
    return m_nnz + m_hat_nnz - (2 * nnz_intersect)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号