-
Notifications
You must be signed in to change notification settings - Fork 0
/
testEffectMatcher.py
31 lines (24 loc) · 1.32 KB
/
testEffectMatcher.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
25
26
27
28
29
30
31
'''
Created on 20 dec. 2016
@author: Robert-Jan
'''
from models.GeneratedExpressionDataset import GeneratedExpressionDataset;
def testEffectMatcher():
print("Preloading data...");
dataset = GeneratedExpressionDataset('./data/seq2ndmarkov_both_2/all.txt', './data/seq2ndmarkov_both_2/test.txt', './data/seq2ndmarkov_both_2/config.json',
operators=2,
digits=8,
dataset_type=GeneratedExpressionDataset.DATASET_SEQ2NDMARKOV,
bothcause=True,
finishExpressions=True);
print("Starting test...");
for i in range(len(dataset.expressionsByPrefix.expressions)):
if (i % 1000):
print("%.2f%% done" % (i / 10000.));
top = dataset.strToIndices(dataset.expressionsByPrefix.expressions[i]);
bot = dataset.strToIndices(dataset.expressionsByPrefix.primedExpressions[i]);
test = dataset.effect_matcher_seq2ndmarkov_both_2(top, bot, 8, 2, True);
if (not test):
print("(effect) %d is wrong: top = %s, bot = %s" % (i, dataset.expressionsByPrefix.expressions[i], dataset.expressionsByPrefix.primedExpressions[i]));
if __name__ == '__main__':
testEffectMatcher();