MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / generate_math

Method generate_math

python/graphvite/dataset.py:602–609  ·  view source on GitHub ↗
(self, save_file, num_triplet)

Source from the content-addressed store, hash-verified

600 self.generate_math(save_file, num_triplet=1000)
601
602 def generate_math(self, save_file, num_triplet):
603 with open(save_file, "w") as fout:
604 for _ in range(num_triplet):
605 i = int(np.random.rand() * len(self.OPERATORS))
606 op, f = self.OPERATORS[i]
607 x = int(np.random.rand() * self.NUM_ENTITY)
608 y = int(np.random.rand() * self.NUM_RELATION) + 1
609 fout.write("%d\t%s%d\t%d\n" % (x, op, y, f(x, y)))
610
611
612class FB15k(Dataset):

Callers 3

train_preprocessMethod · 0.95
valid_preprocessMethod · 0.95
test_preprocessMethod · 0.95

Calls

no outgoing calls

Tested by 1

test_preprocessMethod · 0.76