results_xbow_ht764=select_n_taps( paste(results_dir,"/","glad_xbow1_target.txt_glad_H764_target.txt_lm__cv_results.csv",sep=""),"Xbow",c("X1","X2","X6"))
## [1] " > 20 | 0.9764 | <= 20 | 6.81426533281217e-27"
## [1] " > 20 | 0.6246 | <= 20 | 3.60707965351054e-31"
## [1] " > 60 | 0.475 | <= 60 | 2.68226427668697e-70"
imunum=6
results=exptraintest(imunum,results_xbow_ht764$tap)
## [1] "sensor 1"
## [1] "Sequencing data.."
## [1] "Done 186581 sequences"
## [1] "Done 60561 sequences"
## [1] "TrainTest"
## [1] "sensor 2"
## [1] "Sequencing data.."
## [1] "Done 186581 sequences"
## [1] "Done 60561 sequences"
## [1] "TrainTest"
## [1] "sensor 6"
## [1] "Sequencing data.."
## [1] "Done 186541 sequences"
## [1] "Done 60521 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.17974813 0.20076939 0.00263183
ma_on_T1=as.data.frame(calculate_ma(imunum,c(0,imu_datainterval[[imunum]]$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.1311236 0.1692494 0.005038667
## 2 5 0.1416122 0.1924188 0.004202141
## 3 10 0.1307684 0.1704638 0.004869298
## 4 15 0.1296683 0.1559764 0.005925485
## 5 20 0.1302254 0.1576058 0.007122535
## 6 25 0.1349331 0.1666930 0.008380539
## 7 30 0.1405046 0.1704088 0.009666546
## 8 35 0.1450630 0.1753239 0.010963011
## 9 40 0.1500937 0.1836182 0.012263281
## 10 45 0.1554865 0.1899876 0.013562262
## 11 50 0.1609606 0.1958700 0.014856239
## 12 55 0.1661209 0.2029256 0.016143953
## 13 60 0.1711193 0.2095815 0.017424335
## 14 65 0.1762006 0.2153482 0.018697062
## 15 70 0.1812358 0.2216588 0.019962075
## 16 75 0.1859608 0.2277531 0.021219246
## 17 80 0.1905796 0.2334805 0.022468960
## 18 85 0.1952034 0.2391837 0.023711353
## 19 90 0.1997104 0.2449834 0.024946623
## 20 95 0.2040216 0.2505232 0.026174990
## 21 100 0.2082357 0.2560190 0.027396622
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
)
We use the the best taps found in T1 on T2
ma_on_T2=as.data.frame(calculate_ma(imunum,c(imu_datainterval[[imunum]]$start,imu_datainterval[[imunum]]$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.2549539 0.3772220 0.004807195
## 2 5 0.2736208 0.4304908 0.003877978
## 3 10 0.2471718 0.3809888 0.004079647
## 4 15 0.2372584 0.3319097 0.004584375
## 5 20 0.2267379 0.3165434 0.005231737
## 6 25 0.2287724 0.3351076 0.005953570
## 7 30 0.2340747 0.3340857 0.006701581
## 8 35 0.2347451 0.3276270 0.007448932
## 9 40 0.2368895 0.3376829 0.008195459
## 10 45 0.2401618 0.3423338 0.008935355
## 11 50 0.2441532 0.3416818 0.009664588
## 12 55 0.2467959 0.3459182 0.010384577
## 13 60 0.2492847 0.3510722 0.011093238
## 14 65 0.2526124 0.3521083 0.011791726
## 15 70 0.2560078 0.3538503 0.012482373
## 16 75 0.2586339 0.3570660 0.013166669
## 17 80 0.2610609 0.3584933 0.013844687
## 18 85 0.2641964 0.3592664 0.014517734
## 19 90 0.2671246 0.3607827 0.015187275
## 20 95 0.2695098 0.3618093 0.015854337
## 21 100 0.2718392 0.3622586 0.016518896
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`)]
)
print(comparison)
## 1 2 6
## Moving Average 0.2372584 0.3319097 0.003877978
## TD-MLR 0.1797481 0.2007694 0.002631830