knitr::opts_chunk$set(echo = TRUE) library(eyelinesOnline) library(knitr) load(params$path)
my_path <- paste0(str_filter(experiment[[1]]$file_data$filename_edf, '(^.+/[[:digit:]]+)/[[:digit:]]+.edf')[[1]][2], '/') cat(my_path) experiment_date <- paste0('Experiment date: ', experiment[[1]]$file_data$date) report_date <- paste0('Report date: ', format(Sys.Date(), format="%d.%m.%Y")) cat(paste0(experiment_date, '\n', report_date))
cat(paste0('Scores = ', format(mean( sapply( Filter( function(x) x$file_data$score && x$file_data$record_type %in% c('train','test') , experiment ), function(x) x$file_data$score ) ), digits = 2)))
filename <- file.path(dirname(params$path), 'dump.txt') eval(parse(text = paste0(readLines(filename, warn = F), collapse = '\n'))) cat(sprintf('Target epochs: %i Nontarget epochs: %i Specifity: Train: %.3f ± %.3f Test: %.3f ± %.3f Sensivity: Train: %.3f ± %.3f Test: %.3f ± %.3f Accuracy: Train: %.3f ± %.3f Test: %.3f ± %.3f AUC: Train: %.3f ± %.3f Test: %.3f ± %.3f All: %.3f ± %.3f ', res$target_epochs, res$nontarget_epochs, res$quality$spec$tr[1], res$quality$spec$tr[2], res$quality$spec$tst[1], res$quality$spec$tst[2], res$quality$sens$tr[1], res$quality$sens$tr[2], res$quality$sens$tst[1], res$quality$sens$tst[2], res$quality$acc$tr[1], res$quality$acc$tr[2], res$quality$acc$tst[1], res$quality$acc$tst[2], res$quality$auc$tr[1], res$quality$auc$tr[2], res$quality$auc$tst[1], res$quality$auc$tst[2], res$quality$auc$all[1], res$quality$auc$all[2]))
events <- data.frame() for ( i in 1:length(experiment)) { if(experiment[[i]]$file_data$record_type == 'test') { events <- rbind(events, experiment[[i]]$events) } } TP_ball <- length(which(events$quick_fixation == T & events$activation == T & events$field_type == 'ball' & events$changed_selection == F)) TP_cell <- length(which(events$quick_fixation == T & events$activation == T & events$field_type == 'field' & events$changed_selection == F)) TN_ball <- length(which(events$quick_fixation == T & events$activation == F & events$field_type == 'ball' & events$changed_selection == F)) TN_cell <- length(which(events$quick_fixation == T & events$activation == F & events$field_type == 'field' & events$changed_selection == F)) FP_ball <- length(which((events$false_alarm == T | events$changed_selection == T) & events$field_type == 'ball' & events$quick_fixation == TRUE)) FP_cell <- length(which((events$false_alarm == T | events$changed_selection == T) & events$field_type == 'field' & events$quick_fixation == TRUE)) FN_ball <- length(which(events$quick_fixation == F & events$activation == T & events$field_type == 'ball' & events$changed_selection == F)) FN_cell <- length(which(events$quick_fixation == F & events$activation == T & events$field_type == 'field' & events$changed_selection == F)) df_for_table <- data.frame(type = c('ball', 'cell'), TP = c(TP_ball, TP_cell), TN = c(TN_ball, TN_cell), FP = c(FP_ball, FP_cell), FN = c(FN_ball, FN_cell), INTENT = c(TP_ball + FN_ball, TP_cell + FN_cell), SPONT = c(TN_ball + FP_ball, TN_cell + FP_cell), SENS = c((TP_ball / (TP_ball + FN_ball)), (TP_cell / (TP_cell + FN_cell))), SPEC = c((1 - (FP_ball / (TN_ball + FP_ball))), (1 - (FP_cell / (TN_cell + FP_cell)))))
``` {r, echo=FALSE} kable(df_for_table, format = 'markdown', align = 'l', digits = 3, padding = 4) remove(df_for_table)
```r events <- data.frame() for ( i in 1:length(experiment)) { if(experiment[[i]]$file_data$record_type == 'random') { events <- rbind(events, experiment[[i]]$events) } } if(length(events)){ TP_ball <- length(which(events$quick_fixation == T & events$activation == T & events$field_type == 'ball' & events$changed_selection == F)) TP_cell <- length(which(events$quick_fixation == T & events$activation == T & events$field_type == 'field' & events$changed_selection == F)) TN_ball <- length(which(events$quick_fixation == T & events$activation == F & events$field_type == 'ball' & events$changed_selection == F)) TN_cell <- length(which(events$quick_fixation == T & events$activation == F & events$field_type == 'field' & events$changed_selection == F)) FP_ball <- length(which((events$false_alarm == T | events$changed_selection == T)& events$field_type == 'ball' & events$quick_fixation == TRUE)) FP_cell <- length(which((events$false_alarm == T | events$changed_selection == T) & events$field_type == 'field' & events$quick_fixation == TRUE)) FN_ball <- length(which(events$quick_fixation == F & events$activation == T & events$field_type == 'ball' & events$changed_selection == F)) FN_cell <- length(which(events$quick_fixation == F & events$activation == T & events$field_type == 'field' & events$changed_selection == F)) df_for_table <- data.frame(type = c('ball', 'cell'), TP = c(TP_ball, TP_cell), TN = c(TN_ball, TN_cell), FP = c(FP_ball, FP_cell), FN = c(FN_ball, FN_cell), INTENT = c(TP_ball + FN_ball, TP_cell + FN_cell), SPONT = c(TN_ball + FP_ball, TN_cell + FP_cell), SENS = c((TP_ball / (TP_ball + FN_ball)), (TP_cell / (TP_cell + FN_cell))), SPEC = c((1 - (FP_ball / (TN_ball + FP_ball))), (1 - (FP_cell / (TN_cell + FP_cell))))) }
``` {r, echo=FALSE} if(exists('df_for_table')){ kable(df_for_table, format = 'markdown', align = 'l', digits = 3, padding = 4) } else { cat('No records with random classifier were made') }
\pagebreak ## Dwells ```r DH <- dwell_histogram(experiment) DH
for (i in 1:length(experiment)){ if(experiment[[i]]$file_data$record_type == 'test' || experiment[[i]]$file_data$record_type == 'random'){ cat( str_filter(experiment[[i]]$file_data$filename_r2e, '[[:digit:]]+.r2e')[[1]][1], '(', experiment[[i]]$file_data$record_type, ') - ', sum(experiment[[i]]$events$changed_selection == TRUE & experiment[[i]]$events$quick_fixation == TRUE), ' changed selection (without report FA) and ' , sum(experiment[[i]]$events$false_alarm & experiment[[i]]$events$quick_fixation == TRUE), ' FA reported \n', sep = "") } }
\pagebreak
draw_eeg_epochs_random(experiment, 'true_positive')
\pagebreak
draw_eeg_epochs_random(experiment, 'true_negative')
\pagebreak
draw_eeg_epochs_random(experiment, 'false_negative')
\pagebreak
draw_eye_epochs(experiment)
\pagebreak
remove(experiment) remove(res) remove(my_path) remove(experiment_date) remove(report_date)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.