For pattern recognition, you might look into these references:
# References:
# 1. Ming Li; Xin Chen; Xin Li; Bin Ma; Vitanyi, P.M.B.; , "The similarity metric,"
# Information Theory, IEEE Transactions on , vol.50, no.12, pp. 3250- 3264, Dec. 2004
# http://homepages.cwi.nl/~paulv/papers/similarity.pdf
#
# 2. Lin, Jessica, et al. "A symbolic representation of time series, with implications for
# streaming algorithms." Proceedings of the 8th ACM SIGMOD workshop on Research issues
# in data mining and knowledge discovery. ACM, 2003.
# www.cs.ucr.edu/~stelo/papers/DMKD03.pdf
I wrote some code in Quantopian based on zlib for pattern recognition. I'm not sure that I left the code in a useful state...if anyone is interested, I can check it and post an example. Note that although not listed on the Quantopian help page, zlib is available for import. Just use:
import zlib
Grant