Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph4Rec的例子报错了 #442

Open
xinDongY opened this issue Jul 31, 2022 · 0 comments
Open

Graph4Rec的例子报错了 #442

xinDongY opened this issue Jul 31, 2022 · 0 comments

Comments

@xinDongY
Copy link

运行下面这段代码的时候报错了
node_types_file = "./rec_data/node_types.txt"
edges_file = "./rec_data/user2movie.txt"
embed_path = "./outputs_custom/metapath2vec.0721/embedding/"
movie_name_file = "./rec_data/nid2movieName.txt"

nid2type = load_vocab(node_types_file)
movie2vec, vec_dim = load_embed(embed_path, nid2type, dtype="movie")
user2vec, _ = load_embed(embed_path, nid2type, dtype="user")

print("building ann tree")
annIndex = AnnTree(user2vec, vec_dim)

print("loading user2likedMovies")
user2likedMovies = load_user2movies(edges_file)

print("loading movie2name")
movie2name = load_movie2name(movie_name_file)

报错如下

UnboundLocalError Traceback (most recent call last)
/tmp/ipykernel_817/749958165.py in
5
6 nid2type = load_vocab(node_types_file)
----> 7 movie2vec, vec_dim = load_embed(embed_path, nid2type, dtype="movie")
8 user2vec, _ = load_embed(embed_path, nid2type, dtype="user")
9

~/Graph4Rec/evaluation/evaluation.py in load_embed(embed_file, metaID2type, dtype)
50 vec_dim = len(embed)
51
---> 52 return nodeID2vec, vec_dim
53
54 def filter_nodes(nodeID2vec, target_nodeID_list):

UnboundLocalError: local variable 'vec_dim' referenced before assignment

不清楚 'vec_dim'在之前如何被使用过

@xinDongY xinDongY reopened this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant