In [1]:
import generate_synthetic_data as gsd
import matplotlib.pyplot as plt
import template_patterns as tp
import recognizer as rc

AMPLITUDE_SIGMA = 0.05
TIME_SIGMA = 0.05
PATTERN_LENGTH = 70 # Must be multiple of 7

template_pat = tp.template_patterns()

In [5]:
# For testing 1 pattern
gsd.test_pattern_results(template_pat,'head and shoulders',AMPLITUDE_SIGMA,TIME_SIGMA,PATTERN_LENGTH)


Detected as double top
Distortion value: 0.144380558092
Wrong Detection
Out[5]:
False

In [4]:
# For testing all pattern

accuracy_count = 0
template_pat = tp.template_patterns()
for pat_name in template_pat:
    isCorrect = gsd.test_pattern_results(template_pat,pat_name,AMPLITUDE_SIGMA,TIME_SIGMA,PATTERN_LENGTH)
    if isCorrect is True:
        accuracy_count += 1

print('Accuracy: ' + str(accuracy_count) + '/' + str(len(template_pat)))


Detected as head and shoulders
Distortion value: 0.212487846098
Correct Detection!
Detected as inverse head and shoulders
Distortion value: 0.0471325287447
Correct Detection!
Detected as triple top
Distortion value: 0.126024316162
Wrong Detection
Detected as inverse rounded top
Distortion value: 0.104717114947
Wrong Detection
Detected as double top
Distortion value: 0.16835444613
Wrong Detection
Detected as inverse double top
Distortion value: 0.168237088964
Wrong Detection
Detected as rounded top
Distortion value: 0.194149035254
Correct Detection!
Detected as inverse rounded top
Distortion value: 0.119960609272
Correct Detection!
Detected as spike top
Distortion value: 0.279069904351
Correct Detection!
Detected as inverse spike top
Distortion value: 0.244435700684
Correct Detection!
Accuracy: 6/10

In [ ]:


In [ ]:


In [ ]: