Beispiel #1
0
def getRabeData(sensors, length, shift=256):
    from abraxas4.abraxasFrame import AbraxasFrame
    b = AbraxasFrame(numIrSensors=10, numFrSensors=2, windowWidth=length, windowShift=shift, numFreqs=0, numCoeffs=0,
                          enaStatFeats=False, featNormMethod='none', trainFraction=2/3, waveletLvl1=False,
                          randomSortTT=False, classSortTT=True)

    b.setWindowFunction(functionName='rect', alpha=0.25)
    # b.plotWindowFunction()

    b.selectSensorSubset(selectedSensors=[False, False, False], sensorType='bno')
    b.selectSensorSubset(selectedSensors=[], sensorType='fr')
    b.selectSensorSubset(selectedSensors=sensors, sensorType='ir')
    #b.selectSensorSubset(selectedSensors=[2], sensorType='ir')

    b.addDataFiles(fileSourceName="igor2.txt", fileSourcePath="../", startTime=600, stopTime=6000, label=0)

    b.addDataFiles(fileSourceName="ankita_pos2_lrRl.txt", fileSourcePath="../", startTime=150, stopTime=2500, label=1)

    b.addDataFiles(fileSourceName="markus.txt", fileSourcePath="../", startTime=500, stopTime=3300, label=2)

    dataSet = b.readDataSet(checkData=False, equalLength=True)
    # dataSet := Array with shape dataSet[i][j, k], where i refers to the i-th file loaded, k indicates the sensor and
    #         j is the "time"-index.

    wData, wLabels = b.windowSplitSourceDataTT(inputData=dataSet, inputLabels=np.array([0, 1, 2]))

    wLabels = np.array(wLabels)
    print("Number of windows, Igor: ", str(np.size(wLabels[wLabels == 0])))
    print("Number of windows, Ankita: ", str(np.size(wLabels[wLabels == 1])))
    print("Number of windows, Markus: ", str(np.size(wLabels[wLabels == 2])))

    igor = []
    ankita = []
    markus = []

    #for i in range(len(wLabels)):
    #    wData[i] = wData[i]*(1+0*np.random.random([250, 1]))

    for i in range(len(wLabels)):
        if wLabels[i]==0:
            igor.append(wData[i]*1)
        if wLabels[i]==1:
            ankita.append(wData[i]*1)
        if wLabels[i]==2:
            markus.append(wData[i]*1)
    return igor, ankita, markus
Beispiel #2
0
                 numFrSensors=2,
                 windowWidth=250,
                 windowShift=50,
                 numFreqs=0,
                 numCoeffs=0,
                 enaStatFeats=False,
                 featNormMethod='none',
                 trainFraction=2 / 3,
                 waveletLvl1=False,
                 randomSortTT=False,
                 classSortTT=True)

b.setWindowFunction(functionName='rect', alpha=0.25)
# b.plotWindowFunction()

b.selectSensorSubset(selectedSensors=[False, False, False], sensorType='bno')
b.selectSensorSubset(selectedSensors=[], sensorType='fr')
b.selectSensorSubset(selectedSensors=[0, 1, 2, 3, 5, 7, 9], sensorType='ir')

b.addDataFiles(fileSourceName="igor2.txt",
               fileSourcePath="../",
               startTime=600,
               stopTime=6000,
               label=0)

b.addDataFiles(fileSourceName="ankita_pos2_lrRl.txt",
               fileSourcePath="../",
               startTime=150,
               stopTime=2500,
               label=1)
Beispiel #3
0
                           windowWidth=100,
                           windowShift=10,
                           numCoeffs=5,
                           numFreqs=1,
                           enaStatFeats=True,
                           wavelet='haar',
                           waveletLvl1=False,
                           featNormMethod='stand',
                           trainFraction=0.66,
                           classSortTT=True,
                           randomSortTT=False,
                           lineThresholdAfterNorm=10,
                           enaRawFeats=False,
                           corrPeaks=2)

    xgbAbra.selectSensorSubset(selectedSensors=[False, True, True],
                               sensorType='bno')

    xgbAbra.addDataFiles(fileSourceName="igor.txt",
                         fileSourcePath="../",
                         startTime=3550,
                         stopTime=3800,
                         label=0,
                         className="not walking")
    xgbAbra.addDataFiles(fileSourceName="igor2.txt",
                         fileSourcePath="../",
                         startTime=300,
                         stopTime=500,
                         label=0)
    xgbAbra.addDataFiles(fileSourceName="ankita.txt",
                         fileSourcePath="../",
                         startTime=0,
Beispiel #4
0
                 numFrSensors=2,
                 windowWidth=250,
                 windowShift=50,
                 numFreqs=0,
                 numCoeffs=0,
                 enaStatFeats=False,
                 featNormMethod='none',
                 trainFraction=2 / 3,
                 waveletLvl1=False,
                 randomSortTT=False,
                 classSortTT=True)

b.setWindowFunction(functionName='kaiser', alpha=0.25)
# b.plotWindowFunction()

b.selectSensorSubset(selectedSensors=[False, False, False], sensorType='bno')
b.selectSensorSubset(selectedSensors=[], sensorType='fr')
# b.selectSensorSubset(selectedSensors=[0], sensorType='ir')

b.addDataFiles(fileSourceName="igor2.txt",
               fileSourcePath="../",
               startTime=600,
               stopTime=6000,
               label=0)

b.addDataFiles(fileSourceName="ankita_pos2_lrRl.txt",
               fileSourcePath="../",
               startTime=150,
               stopTime=2500,
               label=1)
Beispiel #5
0
                  windowShift=10,
                  numFreqs=1,
                  numCoeffs=3,
                  enaStatFeats=True,
                  featNormMethod='stand',
                  trainFraction=2 / 3,
                  waveletLvl1=False,
                  randomSortTT=False,
                  classSortTT=True,
                  corrPeaks=0,
                  enaRawFeats=False,
                  statStages=3)

oc.setWindowFunction(functionName='tukey', alpha=0.1)

oc.selectSensorSubset(selectedSensors=[False, True, True], sensorType='bno')
# oc.selectSensorSubset(selectedSensors=[], sensorType='fr')
# oc.selectSensorSubset(selectedSensors=[0], sensorType='ir')

oc.addDataFiles(fileSourceName="chrisOut2.txt",
                fileSourcePath="../",
                startTime=1500,
                stopTime=5000,
                label=0)
oc.addDataFiles(fileSourceName="chrisOut2.txt",
                fileSourcePath="../",
                startTime=8000,
                stopTime=13000,
                label=0)
oc.addDataFiles(fileSourceName="chrisOut2.txt",
                fileSourcePath="../",
Beispiel #6
0
"""
cb, 07.08.2018

 - user identification (with non walking data) using decision tree alg

"""

from abraxas4.abraxasFrame import AbraxasFrame

gNbAbra = AbraxasFrame(numIrSensors=10, numFrSensors=2, windowWidth=50, windowShift=50, numFreqs=1, numCoeffs=1,
                 enaStatFeats=True, featNormMethod='minmax', trainFraction=2/3, waveletLvl1=False, randomSortTT=False,
                 classSortTT=True, corrPeaks=0, enaRawFeats=False)

gNbAbra.setWindowFunction(functionName='tukey', alpha=0.1)

gNbAbra.selectSensorSubset(selectedSensors=[False, False, False], sensorType='bno')
gNbAbra.selectSensorSubset(selectedSensors=[0, 1, 2], sensorType='ir')
gNbAbra.selectSensorSubset(selectedSensors=[], sensorType='fr')
'''
gNbAbra.addDataFiles(fileSourceName="igor.txt", fileSourcePath="../", startTime=3550, stopTime=3800, label=0,
               className="not walking")
gNbAbra.addDataFiles(fileSourceName="igor2.txt", fileSourcePath="../", startTime=300, stopTime=500, label=0)
gNbAbra.addDataFiles(fileSourceName="ankita.txt", fileSourcePath="../", startTime=0, stopTime=150, label=0)
gNbAbra.addDataFiles(fileSourceName="markusSchnell.txt", fileSourcePath="../", startTime=4100, stopTime=4300, label=0)
gNbAbra.addDataFiles(fileSourceName="stefan.txt", fileSourcePath="../", startTime=7600, stopTime=8600, label=0)
gNbAbra.addDataFiles(fileSourceName="stefan.txt", fileSourcePath="../", startTime=0, stopTime=300, label=0)
gNbAbra.addDataFiles(fileSourceName="ben.txt", fileSourcePath="../", startTime=0, stopTime=1000, label=0)
gNbAbra.addDataFiles(fileSourceName="ben.txt", fileSourcePath="../", startTime=7100, stopTime=8000, label=0)
gNbAbra.addDataFiles(fileSourceName="chris1.txt", fileSourcePath="../", startTime=5200, stopTime=6000, label=0)
gNbAbra.addDataFiles(fileSourceName="novcc.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)
gNbAbra.addDataFiles(fileSourceName="nowalk.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)
Beispiel #7
0
import random
import xgboost
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import train_test_split

#abra = AbraxasFrame(numIrSensors=10, numFrSensors=2, windowWidth=100, windowShift=10, numCoeffs=5, numFreqs=1,
#                     enaStatFeats=True, wavelet='haar', waveletLvl1=False, featNormMethod='stand', trainFraction=0.66,
#                     classSortTT=True, randomSortTT=False, lineThresholdAfterNorm=10, enaRawFeats=False, corrPeaks=2)

abra = AbraxasFrame(numIrSensors=10, numFrSensors=2, windowWidth=100, windowShift=10, numFreqs=1, numCoeffs=5,
                      enaStatFeats=True, featNormMethod='stand', trainFraction=2/3, waveletLvl1=False,
                      randomSortTT=False, classSortTT=True, corrPeaks=1, enaRawFeats=False)

abra.setWindowFunction(functionName='tukey', alpha=0.3)
abra.selectSensorSubset(selectedSensors=[False, False, False], sensorType='bno')

abra.addDataFiles(fileSourceName="igor.txt", fileSourcePath="../", startTime=3550, stopTime=3800, label=0,
                     className="not walking")
abra.addDataFiles(fileSourceName="igor2.txt", fileSourcePath="../", startTime=300, stopTime=500, label=0)
abra.addDataFiles(fileSourceName="ankita.txt", fileSourcePath="../", startTime=0, stopTime=150, label=0)
abra.addDataFiles(fileSourceName="markusSchnell.txt", fileSourcePath="../", startTime=4100, stopTime=4300, label=0)
abra.addDataFiles(fileSourceName="stefan.txt", fileSourcePath="../", startTime=7600, stopTime=8600, label=0)
abra.addDataFiles(fileSourceName="stefan.txt", fileSourcePath="../", startTime=0, stopTime=300, label=0)
abra.addDataFiles(fileSourceName="ben.txt", fileSourcePath="../", startTime=0, stopTime=1000, label=0)
abra.addDataFiles(fileSourceName="ben.txt", fileSourcePath="../", startTime=7100, stopTime=8000, label=0)
abra.addDataFiles(fileSourceName="chris1.txt", fileSourcePath="../", startTime=5200, stopTime=6000, label=0)
abra.addDataFiles(fileSourceName="novcc.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)
abra.addDataFiles(fileSourceName="nowalk.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)
abra.addDataFiles(fileSourceName="nowalk2.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)
abra.addDataFiles(fileSourceName="nowalk3.txt", fileSourcePath="../", startTime=0, stopTime=10000, label=0)