Time series data mining code