-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph_based_word2vec_test.py
24 lines (18 loc) · 1.24 KB
/
graph_based_word2vec_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import unittest
import graph_based_word2vec as gbw
class TestGraphBasedWord2vec(unittest.TestCase):
def test_1(self):
# Fixed parameters for word2vec
sg = 1 # Only care about skip-gram
keep_folder = 'output/intermediate data for unittest/graph/keep/'
gs = gbw.GridSearch_new(training_data_folder='data/training data/unittest_data',
index2word_path=keep_folder + 'dict_merged_undirected_for_unittest.txt',
merged_word_count_path=keep_folder + 'word_count_all_undirected.txt',
valid_vocabulary_path=keep_folder + 'valid_vocabulary_min_count_5_undirected.txt',
workers=1, sg=sg, negative=1)
# gs.one_search(ns_path=None)
gs.one_search(matrix_path='output/intermediate data for unittest/negative_samples/encoded_edges_count_window_size_6_vocab_size_none_undirected_for_unittest_1_step_rw_matrix.npy',
graph_index2wordId_path='output/intermediate data for unittest/negative_samples/encoded_edges_count_window_size_6_vocab_size_none_undirected_for_unittest_1_step_rw_nodes.pickle',
power=0.75)
if __name__ == '__main__':
unittest.main()