bi_pred.py 文件源码

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

项目:GitHub-Repo-Recommender 作者: frankyjuang 项目源码 文件源码
def check_predict(_):
    print("#", end="")
    sys.stdout.flush()
    max_b = 0
    user_indices = random.choices(range(len(users)), k=N_PER_CHUNK)
    repo_indices = random.choices(range(len(repos)), k=N_PER_CHUNK)
    for index in range(N_PER_CHUNK):
        if B[user_indices[index], repo_indices[index]] == 1.0:  # Link already exists.
            continue
        new_b = U[user_indices[index], :] @ V[:, repo_indices[index]]
        if new_b > max_b:
            max_b = new_b
            user_id = users[user_indices[index]]
            repo_id = repos[repo_indices[index]]
            best_pred = (user_id, user_id2name[user_id],
                         repo_id, repo_id2name[repo_id],
                         new_b)
    # print(best_pred)
    return best_pred
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号