HKUST-KnowComp / MNE

Source Code for IJCAI 2018 paper "Scalable Multiplex Network Embedding"
75 stars 25 forks source link

error: builtins.TypeError: __init__() missing 1 required positional argument: 'vector_size' #3

Closed Sandy4321 closed 6 years ago

Sandy4321 commented 6 years ago

Please help to fix error: was used Windows computer nx.version '2.1' gs.version '3.4.0'

messages from start C:\Users\sndr\Anaconda3\lib\site-packages\gensim\utils.py:1197: UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows; aliasing chunkize to chunkize_serial") We are loading data from: Vickers-Chan-7thGraders_multiplex.edges Finish loading data finish building the graph Slow version of MNE is being used

error File "E:\graphs ML\code\Scalable_Multiplex_Network-EmbeddingMNE_master\MNE-master\train_model.py", line 14, in model = train_model(edge_data_by_type) File "E:\graphs ML\code\Scalable_Multiplex_Network-EmbeddingMNE_master\MNE-master\MNE.py", line 116, in train_model baseembedding, , _, context_embedding, index2word = train_embedding(None, base_walks, 'Base', 100, 10, 1) File "E:\graphs ML\code\Scalable_Multiplex_Network-EmbeddingMNE_master\MNE-master\MNE.py", line 104, in train_embedding new_model = MNE(training_data, size=200, window=5, min_count=0, sg=1, workers=4, iter=iter, small_size=info_size, initial_embedding=initial_embedding, base_weight=base_weight) File "E:\graphs ML\code\Scalable_Multiplex_Network-EmbeddingMNE_master\MNE-master\MNE.py", line 322, in init self.initialize_word_vectors() File "E:\graphs ML\code\Scalable_Multiplex_Network-EmbeddingMNE_master\MNE-master\MNE.py", line 366, in initialize_word_vectors self.wv = KeyedVectors()

builtins.TypeError: init() missing 1 required positional argument: 'vector_size'

error location def initialize_word_vectors(self): self.wv = KeyedVectors()

Sandy4321 commented 6 years ago

import gensim as gs gs.version '3.4.0'

panda0881 commented 6 years ago

The error is raised because you are using a different version of gensim. But anyway, I have updated the gensim to 3.4 and solve the bug.

Best Regards, Hongming

Sandy4321 commented 6 years ago

great it works now thanks but how can check if results are correct full test case needed: what is input and what is output
Something similar to your paper " Figure 2: Node classification result" and Table 2 Common Neighbor (CN) 0.799 (0.011) Jaccard Coeficient (JC) 0.778 (0.007) Adamic/Adar (AA) 0.803 (0.019) MNE 0.871 (0.014) may you help find what result should be and if I get it correctly for your test file

This python file is used to train the Multiplex Network Embedding model

Author: Hongming ZHANG, HKUST KnowComp Group

import networkx as nx import Random_walk from MNE import * import sys

file_name = sys.argv[1]

file_name = 'data/Vickers-Chan-7thGraders_multiplex.edges'

file_name = 'e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\data\Vickers-Chan-7thGraders_multiplex.edges' edge_data_by_type, all_edges, all_nodes = load_network_data(file_name) model = train_model(edge_data_by_type) save_model(model, 'model')

the message is C:\Users\sndr\Anaconda3\lib\site-packages\gensim\utils.py:1197: UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows; aliasing chunkize to chunkize_serial") We are loading data from: e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\data\Vickers-Chan-7thGraders_multiplex.edges Finish loading data finish building the graph Slow version of MNE is being used e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\MNE.py:655: UserWarning: C extension not loaded for Word2Vec, training will be slow. Install a C compiler and reinstall gensim for fast training. warnings.warn("C extension not loaded for Word2Vec, training will be slow. " Slow version of MNE is being used under 10 jobs per worker: consider setting a smaller batch_words' for smoother alpha decay Slow version of MNE is being used under 10 jobs per worker: consider setting a smallerbatch_words' for smoother alpha decay Slow version of MNE is being used under 10 jobs per worker: consider setting a smaller `batch_words' for smoother alpha decay

Thanks a lot

panda0881 commented 6 years ago

You can try the main.py file. It will repeat our experiment in the paper and compare our model with all the other baseline methods.

Hongming

Sandy4321 commented 6 years ago

great thanks for soon answer may you help with this error File "e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\main.py", line 520, in LINE_model = train_LINE_model(training_data_by_type[edge_type]) File "e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\main.py", line 275, in train_LINE_model first_order_embedding = read_LINE_vectors('LINE_tmp_embedding1.txt') File "e:\graphs ML\code\Scalable_Multiplex_Network_Embedding_May24_2018\MNE-master\MNE-master\main.py", line 251, in read_LINE_vectors file = open(file_name, 'r')

builtins.FileNotFoundError: [Errno 2] No such file or directory: 'LINE_tmp_embedding1.txt'

Sandy4321 commented 6 years ago

in any case I use Windows computer so C++ code for LINE will not work may you change the code to have the option to run without LINE just not to use LINE code then hopefully the rest will work fine so only one IF statement needs to switch off code to run LINE Thanks PS this code will not run on Windows: command1 = 'C++/LINE/linux/line -train LINE_tmp_edges.txt -output LINE_tmp_embedding1.txt -order 1 base-negative ' + str( negative) + ' -dimension ' + str(dimension / 2) command2 = 'C++/LINE/linux/line -train LINE_tmp_edges.txt -output LINE_tmp_embedding2.txt -order 2 -negative ' + str( negative) + ' -dimension ' + str(dimension / 2)

panda0881 commented 6 years ago

Yes. I tested my code on the Linux system and these few lines simply call the LINE code through the command line. You change that to the windows version or you can simply comment everything about line (l.519, 520, 521, 524, 530, 534, 547, 558, 573, 588) and compare with other baselines first.

Sorry that I don't have a windows pc and I can't help you debug with that.

Hongming