예제 #1
0
def trainingDataFrom_walk1():
    trainingSet = pd.DataFrame()
    # In[39]:

    dfO = pd.read_csv(pathToTrainingData + 'walk1.csv')

    eventWindow = clip(dfO, 7.4, 8.7)
    label = eventsDict['walk'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 8.7, 9.2)
    label = eventsDict['walk'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 9.2, 9.9)
    label = eventsDict['walk'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 9.9, 10.5)
    label = eventsDict['walk'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
예제 #2
0
def testDataFrom_ME1():
    trainingSet = pd.DataFrame()
# In[39]:

    dfO = pd.read_csv(pathToTestData + 'multEvents1.csv')

    eventWindow = clip(dfO, 6, 7)
    label = eventsDict['rest'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 8, 10)
    label = eventsDict['walk'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 25, 28)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 31, 57)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 71, 74)
    label = eventsDict['standUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 88, 90)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 92, 96)
    label = eventsDict['lieDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 101, 104)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 109, 112)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 115, 119)
    label = eventsDict['sitUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
예제 #3
0
def trainingDataFrom_type1():
    trainingSet = pd.DataFrame()
    # In[39]:

    dfO = pd.read_csv(pathToTrainingData + 'type1.csv')

    eventWindow = clip(dfO, 5.0, 6.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 6.0, 7.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 7.0, 8.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 8.0, 9.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 21.0, 22.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 24.0, 25.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 26.0, 27.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(dfO, 28.0, 29.0)
    label = eventsDict['type'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
예제 #4
0
def activity_recognizer(fileName, startTime, endTime):
    accl_readings = pd.read_csv(fileName)
    accl_readings = clip(accl_readings, startTime, endTime)
    eventSequence = find_events(accl_readings)

    activity_fsm = FSM(superStates, internalStatesBySS, SSTransitions,
                       internalTransitionsBySS)

    # get initial state of the FSM. the FSM will remain in this state until the
    # first event occurs.
    (initSSName, initIntSName) = activity_fsm.currentStateLabels()
    activitySequence = [(eventsDict["unk"][0], 0, eventSequence[0][1],
                         initSSName, initIntSName)]
    # print(eventSequence)

    for event in eventSequence:
        activity_fsm.transition(event[0])
        (SSName, intSName) = activity_fsm.currentStateLabels()
        # print(event[0])
        # print(SSName, intSName)
        activitySequence += [(event[0], event[1], event[2], SSName, intSName)]

    return activitySequence
def trainingDataFrom_standtostand3():

    # In[0]:
    df = pd.read_csv(pathToTrainingData + 'standtostand3.csv')

    trainingSet = pd.DataFrame()

    # In[1]:

    eventWindow = clip(df, 11, 15)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[2]:

    eventWindow = clip(df, 16, 21)
    label = eventsDict['lieDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[3]:

    eventWindow = clip(df, 26, 31)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[4]:

    eventWindow = clip(df, 34, 38)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[5]:

    eventWindow = clip(df, 44, 48)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[6]:

    eventWindow = clip(df, 60, 65)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[7]:

    eventWindow = clip(df, 68, 70)
    label = eventsDict['sitUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
예제 #6
0
def trainingDataFrom_standtostand2():

    # In[0]:
    df = pd.read_csv(pathToTrainingData + 'standtostand2.csv')

    trainingSet = pd.DataFrame()

    # In[1]:

    eventWindow = clip(df, 18, 21)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[2]:

    eventWindow = clip(df, 23, 27)
    label = eventsDict['lieDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[3]:

    eventWindow = clip(df, 33, 37)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[4]:

    eventWindow = clip(df, 42, 46)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[5]:

    eventWindow = clip(df, 55, 58)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[6]:

    eventWindow = clip(df, 66, 70)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[7]:

    eventWindow = clip(df, 77, 81)
    label = eventsDict['sitUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[8]:

    eventWindow = clip(df, 87, 90)
    label = eventsDict['standUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
def trainingDataFrom_sitstandmult():

# In[0]:  
    df = pd.read_csv(pathToTrainingData+'sitstandmult.csv')
    
    trainingSet = pd.DataFrame()


# In[1]:  

    eventWindow = clip(df, 9, 12)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 12, 16)
#    label = eventsDict['lieDown'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


#    eventWindow = clip(df, 19, 23)
#    label = eventsDict['sitUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 24, 26)
#    label = eventsDict['standUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


    eventWindow = clip(df, 29, 32)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 33, 36)
#    label = eventsDict['lieDown'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


#    eventWindow = clip(df, 37, 41)
#    label = eventsDict['sitUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 43, 45)
#    label = eventsDict['standUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


    eventWindow = clip(df, 47, 50)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 50, 54)
#    label = eventsDict['lieDown'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


#    eventWindow = clip(df, 56, 59)
#    label = eventsDict['sitUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 60, 62)
#    label = eventsDict['standUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)



    eventWindow = clip(df, 65, 68)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

#    eventWindow = clip(df, 68, 72)
#    label = eventsDict['lieDown'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)



#    eventWindow = clip(df, 73, 77)
#    label = eventsDict['sitUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)


#    eventWindow = clip(df, 78, 80)
#    label = eventsDict['standUp'][1]
#    trainingInstance = convertRawToTrainingInstance(eventWindow, label, reverseEventsDict[label])
#    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
def trainingDataFrom_standtostand1():

    # In[0]:
    df = pd.read_csv(pathToTrainingData + 'standtostand1.csv')

    trainingSet = pd.DataFrame()

    # In[2]:

    eventWindow = clip(df, 8.5, 12)
    label = eventsDict['sitDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[3]:

    eventWindow = clip(df, 16, 20)
    label = eventsDict['lieDown'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[4]:

    eventWindow = clip(df, 28, 32)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[5]:

    eventWindow = clip(df, 34, 37)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[6]:

    eventWindow = clip(df, 45, 49)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[7]:

    eventWindow = clip(df, 51, 55)
    label = eventsDict['turn'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[8]:

    eventWindow = clip(df, 60, 64)
    label = eventsDict['sitUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    eventWindow = clip(df, 68, 70)
    label = eventsDict['standUp'][1]
    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet
예제 #9
0
def trainingDataFrom_one():
    trainingSet = pd.DataFrame()
    # In[39]:

    one = pd.read_csv(pathToTrainingData + 'one.csv')
    one_1 = clip(one, 5, 50)

    # First sit down event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_1, 12, 15)
    label = eventsDict['sitDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First doing nothing event. Add features to training set.
    # -----------------------------------------------------------
    eventWindow = clip(one_1, 16, 20)
    label = eventsDict['rest'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First lyingDown activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_1, 21, 25)
    label = eventsDict['lieDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # 1st situp event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_1, 35, 41)
    label = eventsDict['sitUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Second doing nothing event. Add features to training set.
    # -----------------------------------------------------------
    eventWindow = clip(one_1, 42, 45)
    label = eventsDict['rest'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First stand up activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_1, 46, 48)
    label = eventsDict['standUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[40]:

    one_2 = clip(one, 51, 100)

    # Next sit down event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_2, 57, 60)
    label = eventsDict['sitDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Another doing nothing event. Add features to training set.
    # -----------------------------------------------------------
    eventWindow = clip(one_2, 61, 64)
    label = eventsDict['rest'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First lyingDown activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_2, 64, 69)
    label = eventsDict['lieDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # 2nd situp event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_2, 84, 89)
    label = eventsDict['sitUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Second stand up activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_2, 94, 98)
    label = eventsDict['standUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[41]:

    one_3 = clip(one, 140, 190)

    # Next sit down event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_3, 146, 149)
    label = eventsDict['sitDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Another doing nothing event. Add features to training set.
    # -----------------------------------------------------------
    eventWindow = clip(one_3, 151, 155)
    label = eventsDict['rest'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First lyingDown activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_3, 155, 159)
    label = eventsDict['lieDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # 2nd situp event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_3, 170, 176)
    label = eventsDict['sitUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Second stand up activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_3, 180, 183)
    label = eventsDict['standUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # In[42]:

    one_4 = clip(one, 190, 235)

    # Next sit down event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_4, 191, 195)
    label = eventsDict['sitDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Another doing nothing event. Add features to training set.
    # -----------------------------------------------------------
    eventWindow = clip(one_4, 204, 210)
    label = eventsDict['rest'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # First lyingDown activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_4, 198, 203)
    label = eventsDict['lieDown'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # 2nd situp event. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_4, 218, 223)
    label = eventsDict['sitUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    # Second stand up activity. Add features to training set.
    # ------------------------------------------------------
    eventWindow = clip(one_4, 228, 232)
    label = eventsDict['standUp'][1]

    trainingInstance = convertRawToTrainingInstance(eventWindow, label,
                                                    reverseEventsDict[label])
    trainingSet = trainingSet.append(trainingInstance)

    return trainingSet