Experimental Setup

Basic Configuration paths

slicing=1 # slice windows
kfolds=10
dataset_dir="~/Dropbox/shared/MEMS-ANN/datasets/"
results_dir="~/Dropbox/shared/MEMS-ANN/results/"

All the IMUs datasets are stored in two arrays. One array for the input data and a second one for the using as target

## Datasets
imu_data=c()
## INPUT IMU Data
imu_data[1]=paste(dataset_dir,"glad_data.txt",sep="")
imu_data[2]=paste(dataset_dir,"xbow1_data.txt",sep="")
imu_data[3]=paste(dataset_dir,"xsns1_data.txt",sep="")
imu_data[4]=paste(dataset_dir,"glad_xbow1_target.txt") # xbow based on GLAD frequency
imu_data[5]=paste(dataset_dir,"glad_data.txt",sep="")
imu_data[6]=paste(dataset_dir,"glad_xbow1_target.txt",sep="")
imu_data[7]=paste(dataset_dir,"glad_data.txt",sep="")
imu_data[8]=paste(dataset_dir,"glad_data.txt",sep="")

## TARGET IMU Data
imu_target=c()
imu_target[1]=paste(dataset_dir,"glad_H764_sgolay_target.txt",sep="")
imu_target[2]=paste(dataset_dir,"xbow1_H764_sgolay_target.txt",sep="")
imu_target[3]=paste(dataset_dir,"xsns1_H764_sgolay_target.txt",sep="")
imu_target[4]=paste(dataset_dir,"glad_H764_target.txt",sep="") # target based on GLad Frequency
imu_target[5]=paste(dataset_dir,"glad_H764_target.txt",sep="")
imu_target[6]=paste(dataset_dir,"glad_H764_target.txt",sep="")
imu_target[7]=paste(dataset_dir,"glad_xbow1_target.txt",sep="") # xbow based on GLAD frequency
imu_target[8]=paste(dataset_dir,"glad_xbow1_sgolay_target.txt",sep="") # xbow based on GLAD frequency + SGOLAY

For this particular experiment, we focus on the results of the following IMU configuration:

number Selected IMU Target
1 Glad H764 Sgolay
5 Glad H764
6 Xbow H764
7 Glad Xbow
8 Glad Xbow Sgolay
selected_imus<-c(1,5,6,7,8)

An for each IMU we only select the following sensors:

number Sensor
1 AccX
5 AccY
6 GyroZ
selected_sensors<-c(1,2,6)

We run a 10-folds Crossvalidation for each IMU configuration. Note that we consider only the half of the dataset. This means that only the first dynamic is considered.

Experiment Results

The results for the first IMU configuration are:

Gladiator using H674 with SGOLAY as target:

##   sensorID tap  rsme_mean raw_rsme_mean
## 1       X1  50  0.1842832     0.9861968
## 2       X2  35  0.2144153      1.001892
## 3       X6  80 0.01609296    0.06446901

Crossbow using H674 with SGOLAY as target:

##   sensorID tap   rsme_mean raw_rsme_mean
## 1       X1  15   0.1006706     0.1364613
## 2       X2  15   0.1115267     0.1754952
## 3       X6  40 0.002073314   0.005102698

Gladiator using Xbow with SGOLAY as target:

##   sensorID tap  rsme_mean raw_rsme_mean
## 1       X1  55  0.1832018     0.9823052
## 2       X2  30  0.2305555     0.9917751
## 3       X6  80 0.01568819    0.06452414

Gladiator using XBow as target:

##   sensorID tap  rsme_mean raw_rsme_mean
## 1       X1  50  0.1877725     0.9819367
## 2       X2  35  0.2326269     0.9908202
## 3       X6  80 0.01595021     0.0645949

A plot comparing the performance using the selected TAPs on the full dataset is shown here.

Comparison of the RSME observed by the TD-MLR compared with H784 (with and without SGOLAY)

source("MEMS-evaluation.R",echo = F)

h764s_d<-as.data.frame(fread(imu_target[1],sep=" ",header=F)) #H764 with SGOLAY
h764_d<-as.data.frame(fread(imu_target[4],sep=" ",header=F)) #H764 without SGOLAY

get_prediction <- function(dataset){
  train=dataset[1:(nrow(dataset)/2),]
  test=dataset[(nrow(dataset)/2):nrow(dataset),]
  lmmodel=lm(target ~ .,train)
  return ( predict(lmmodel,test))
}  
get_predections_vs_h764 <- function(taps,imunun){
i=1
h764_rsme=c()
for (sensor in selected_sensors){
      dataset <-seqdata(sensor,taps[i],imunun)
     # h764s <-seqdata(sensor,taps[i],1)$target
     # h764 <-seqdata(sensor,taps[i],6)$target
      glad_xbow_predictions= get_prediction(dataset)
                          
      h764_rsme<- rbind(h764_rsme,  cbind(
      #        rsme(glad_xbow_predictions,h764[(length(h764)/2):length(h764)]),
      #       rsme(glad_xbow_predictions,h764s[(length(h764s)/2):length(h764)]),
                          # xbow RSME agaisnt H764 without SGOLAY
rsme(glad_xbow_predictions,h764_d[ ((nrow(dataset)/2)+(taps[i]-1)):nrow(h764_d),sensor]),
                          # xbow RSME agaisnt H764 with SGOLAY
                          rsme(glad_xbow_predictions,h764s_d[((nrow(dataset)/2)+(taps[i]-1)):nrow(h764s_d),sensor])))
      i=i+1
}
colnames(h764_rsme)<-c("rsme_h764","rmse_h764s")
rownames(h764_rsme)<-c("AccX","AccY","GyroZ")
return (h764_rsme)  
} 

We build the TD-MLR model using Xbow target for sensors selected_sensors with selected taps (according to table) and using the first part of the dataset. We repeat the same for target Xbow SGOLAY. Then we calculate the RSME against the test portion of the h784 (with and without SGOLAY).

glad_h764_vs_h764 <-get_predections_vs_h764 (unlist(results_glad_ht764_sgolay$tap),1)
glad_xbow_vs_h764 <-get_predections_vs_h764 (unlist(results_glad_xbow$tap),7)
glad_xbows_vs_h764 <-get_predections_vs_h764 (unlist(results_glad_xbow_slogay$tap),8)

# TD-MLR h764 sgolay RSME vs h764 and h764 with SGOLAY
glad_h764_vs_h764
##        rsme_h764 rmse_h764s
## AccX  0.22711700 0.20627777
## AccY  0.28840330 0.26577247
## GyroZ 0.01472642 0.01469198
# TD-MLR xbow  RSME vs h764 and h764 with SGOLAY
glad_xbow_vs_h764
##       rsme_h764 rmse_h764s
## AccX  0.2307110 0.21002369
## AccY  0.2953956 0.27243952
## GyroZ 0.0148766 0.01484252
# TD-MLR xbow sgolay RSME vs h764 and h764 with SGOLAY
glad_xbows_vs_h764
##        rsme_h764 rmse_h764s
## AccX  0.22940522 0.20860365
## AccY  0.30096942 0.27836653
## GyroZ 0.01487644 0.01484233

Discussion