Experimental Setup

find Tap number for h764 using T1

results_glad_ht764=select_n_taps( paste(results_dir,"/","glad_data.txt_glad_H764_target.txt_lm__cv_results.csv",sep=""),"Gladiator",c("X1","X2","X6"))
## [1] " > 55 | 0.1428 | <= 55 | 2.01506389330975e-78"
## [1] " > 40 | 0.113 | <= 40 | 6.93662697840351e-62"
## [1] " > 85 | 0.29 | <= 85 | 1.85119777498185e-106"

find Tap number for xbow using T1

results_glad_xbow=select_n_taps( paste(results_dir,"/","glad_data.txt_glad_xbow1_target.txt_lm__cv_results.csv",sep=""),"Gladiator",c("X1","X2","X6"))
## [1] " > 60 | 0.6085 | <= 60 | 3.90089592588e-80"
## [1] " > 35 | 0.6048 | <= 35 | 2.14830944687659e-56"
## [1] " > 85 | 0.1994 | <= 85 | 1.48699296036998e-98"

Now train using the complete T1 and Test on T2

l=list(X1=60,X2=35,X3=85)
results=exptraintest(7,l)
## [1] "sensor 1"
## [1] "Sequencing data.."
## [1] "Done 186541 sequences"
## [1] "Done 60521 sequences"
## [1] "TrainTest"
## [1] "sensor 2"
## [1] "Sequencing data.."
## [1] "Done 186566 sequences"
## [1] "Done 60546 sequences"
## [1] "TrainTest"
## [1] "sensor 6"
## [1] "Sequencing data.."
## [1] "Done 186516 sequences"
## [1] "Done 60496 sequences"
## [1] "TrainTest"
## Warning in write.csv(results, file = paste(paste(results_dir,
## basename(imu_data[imunum]), : attempt to set 'sep' ignored
print(results[,c(2,5,8)])
##         1         2         6 
## 0.2583007 0.3875100 0.0137377

find best tap number of MA on T1

ma_on_T1=as.data.frame(calculate_ma(7,c(0,imu_datainterval[[7]]$start)))
## Warning in write.csv(results, file = paste(paste(results_dir,
## basename(imu_data[imunum]), : attempt to set 'sep' ignored
print(ma_on_T1)
##    timedelay         1         2          6
## 1          1 0.9799492 0.9975366 0.06461782
## 2          5 0.4163138 0.6673569 0.03008951
## 3         10 0.3056882 0.6252918 0.02244409
## 4         15 0.2598294 0.6091789 0.01936749
## 5         20 0.2324714 0.5998606 0.01784117
## 6         25 0.2151841 0.5980838 0.01711055
## 7         30 0.2060406 0.5975132 0.01688719
## 8         35 0.1994189 0.5962444 0.01700084
## 9         40 0.1953873 0.5971286 0.01735454
## 10        45 0.1935093 0.5987203 0.01788920
## 11        50 0.1933398 0.5998045 0.01856248
## 12        55 0.1938131 0.6013555 0.01933768
## 13        60 0.1949259 0.6035619 0.02019310
## 14        65 0.1966927 0.6053352 0.02111329
## 15        70 0.1989677 0.6072548 0.02208398
## 16        75 0.2014953 0.6095251 0.02309230
## 17        80 0.2041393 0.6115939 0.02412805
## 18        85 0.2069585 0.6136689 0.02518515
## 19        90 0.2099925 0.6159337 0.02625702
## 20        95 0.2130824 0.6181962 0.02734340
## 21       100 0.2160718 0.6203297 0.02843914
best_taps_ma=c(
ma_on_T1$timedelay[which.min(ma_on_T1$`1`)], #for sensor1
ma_on_T1$timedelay[which.min(ma_on_T1$`2`)], #for sensor 2
ma_on_T1$timedelay[which.min(ma_on_T1$`6`)] #for sensor 6
)

Now we test MA with 50, 35, 30 taps on T2

We use the the best taps found in T1 on T2

ma_on_T2=as.data.frame(calculate_ma(7,c(imu_datainterval[[7]]$start,imu_datainterval[[7]]$end)))
## Warning in write.csv(results, file = paste(paste(results_dir,
## basename(imu_data[imunum]), : attempt to set 'sep' ignored
print(ma_on_T2)
##    timedelay         1         2          6
## 1          1 0.9847995 1.0910769 0.06453492
## 2          5 0.4321878 0.7634341 0.02921977
## 3         10 0.3452851 0.7596082 0.02128584
## 4         15 0.3217496 0.7559825 0.01781555
## 5         20 0.2960391 0.7357464 0.01593006
## 6         25 0.2828895 0.7425684 0.01483217
## 7         30 0.2806874 0.7492022 0.01419175
## 8         35 0.2794115 0.7444204 0.01384964
## 9         40 0.2766524 0.7458670 0.01370853
## 10        45 0.2765248 0.7517497 0.01372408
## 11        50 0.2783767 0.7518925 0.01384998
## 12        55 0.2799149 0.7524160 0.01405582
## 13        60 0.2806239 0.7558922 0.01433270
## 14        65 0.2824104 0.7575117 0.01467528
## 15        70 0.2845800 0.7577809 0.01506883
## 16        75 0.2866435 0.7596156 0.01548988
## 17        80 0.2882921 0.7612729 0.01593197
## 18        85 0.2903957 0.7615923 0.01639480
## 19        90 0.2925719 0.7626094 0.01687742
## 20        95 0.2943592 0.7634644 0.01737227
## 21       100 0.2959102 0.7639437 0.01788225
ma_rmse=c(
ma_on_T2$`1`[which.min(ma_on_T1$`1`)],
ma_on_T2$`2`[which.min(ma_on_T1$`2`)], 
ma_on_T2$`6`[which.min(ma_on_T1$`6`)] 
)

RSME results of TD-MLR vs MA using T1 for parameters setting and T2 testing.

print(comparison)
##                        1         2          6
## Moving Average 0.2783767 0.7444204 0.01419175
##  TD-MLR        0.2583007 0.3875100 0.01373770