go_knn2.py 文件源码

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

项目:STA141C 作者: clarkfitzg 项目源码 文件源码
def go_nn_kdtree(eps=0, parallel=True):
    """
    Using a specialized data structure, the KDTree

    This is not as performant because we're in a high dimensional space

    0.777 accuracy? Should be 0.794
    """
    n_jobs = 1
    if parallel:
        n_jobs = -1

    neighbors = tree.query(Xtest, eps=eps, n_jobs=n_jobs)
    predictions = ytrain[neighbors[1]]

    acc = np.equal(predictions, ytest).mean()
    return acc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号