Python:识别基于时间序列的数据模式

时间:2016-04-12 06:12:57

标签: python-2.7 machine-learning pattern-matching time-series recurrent-neural-network

我有以下格式的数据集:

11/26/2015 14:00:00 N234    11004066    27.05
11/26/2015 14:01:00 N234    11004066    27.07
11/26/2015 14:02:00 N234    11004066    27.04
11/26/2015 14:03:00 N234    11004066    27.02
11/26/2015 14:04:00 N234    11004066    27.00
11/26/2015 14:05:00 N234    11004066    26.94
11/26/2015 14:06:00 N234    11004066    26.92
11/26/2015 14:07:00 N234    11004066    26.90

对于与时间序列相关的每个数量,我想找到给定数据列所遵循的模式。我想使用半无监督或无监督的神经网络方法,但我是新手。为了对模式进行分类,我编写了一个代码,但是我在将其与ANN概念进一步集成时遇到了问题。

    #-----------------------------------------------------------------------  --------
# Pattern regognition
# 1. shift either increased or decreased
#-------------------------------------------------------------------------------
def shiftPattern(n, mean, var, shift = 0.5, u = 3, increase = 'T'):
'''Pattern to increase and decrease whith shift parameter'''
data = array(normal(n,mean,var))
shift = array([None]*n)
shifts = array([0]*u + [1]*(n-u))
if increase == 'T':
shift = data + shifts
else:
shift = data - shifts
return shift
#-------------------------------------------------------------------------------
# 2. Trend either increased or decreased
#-------------------------------------------------------------------------------
def trendPattern(n, mean, var, slop):
'''trend either increasing or decreasing with slop'''
data = array(normal(n,mean,var))
slops = array(range(1,(n+1)))*slop
trend = data + slops
return trend
#-------------------------------------------------------------------------------
# 3. Cyclic pattern
#-------------------------------------------------------------------------------
def cyclicPattern(n,mean, var, cycleAmplitude, cycleLength):
Control Chart Pattern Recognition using Artificial Neural Network for Multivariate Autocorrelated Processes
Ashenafi Muluneh, (2014) Page 65
'''Cyclic pattern with cycle amplitude add cycle length'''
data = array(normal(n,mean,var))
cycle = data + cycleAmplitude*sin(float(2*pi)*array(range(1,(n+1)))/cycleLength)
return cycle
#-------------------------------------------------------------------------------
# 4. Syatematic pattern
#-------------------------------------------------------------------------------
def systematicPattern(n, mean, var, delta):
'''Syatematic variable with delts'''
data = array(normal(n,mean,var))
dummy = array([(-1)**i for i in range(1,(n+1))])
systematic = data + dummy*delta*var
return systematic

如果有人可以帮助我将这些代码与神经网络集成以识别模式,我将非常感激。

0 个答案:

没有答案