In [1]:
import generate_synthetic_data_series as gsds
import template_patterns as tp
import matplotlib.pyplot as plt
import genetic_algo as ga

# Config Params for random noise in between patterns
noise_params = {}
noise_params['x_mean'] = 30
noise_params['x_sigma'] = 3
noise_params['y_mean'] =  0.5
noise_params['y_sigma'] = 0.1

AMPLITUDE_SIGMA = 0.01
TIME_SIGMA = 0.06

# Pattern to generate
series_tuple = []
series_tuple.append(('head and shoulders',70))
series_tuple.append(('inverse head and shoulders',98))





patterns = tp.template_patterns()
series_x,series_y = gsds.generate_series_of_synthetic_data(patterns, series_tuple,
                                                           AMPLITUDE_SIGMA,TIME_SIGMA,
                                                           noise_params)

plt.plot(series_x,series_y,'-o')
plt.show()

segments = ga.runGA(series_x,series_y)
ga.evaluate(series_x,series_y,segments,True)


Detected as head and shoulders
Distortion value: 0.0361379709922
Detected as double top
Distortion value: 0.187904917462
Detected as head and shoulders
Distortion value: 0.169318726011
Out[1]:
(0.13112053815497834,)

In [ ]: