Skip to content

Latest commit

 

History

History
136 lines (106 loc) · 64.9 KB

validate_response_data.md

File metadata and controls

136 lines (106 loc) · 64.9 KB

Validate Response Data

Load packages

library(dplyr)
library(purrr)
library(tidyr)
library(ggplot2)
library(hash)

Set datapath and load shlab.imgct

Begin by setting the working directory and important top-level paths to data and loading necessary packages.

  • NOTE: This will be changed to dynamically account for the package shlab.imgct via its GitHub instance later. For now, it is using development loading.
# Set the working directory to be part of S Drive (may make dynamic later?)
# Whilst not dynamic, change for own session if mount point is not equivalent on
# local machine
shared_dir <- "~/Projects/shlab/mounts/imgct"
package_dir <- "~/Projects/shlab"

datapath <- file.path(shared_dir, "csn_images")
imgct_package_path <- file.path(package_dir, "shlab.imgct")

# Make sure that devtools, tidyverse are installed before this call
devtools::load_all(imgct_package_path)

Validation of All Clean Blocks

The shlab.imgct package provides a comprehensive validation method to load and validate all clean blocks of participant responses against a “validation key”. This comprehensive method is called validate_all_participants. It is a convenient abstraction on top of load_all_clean_blocks, load_key, validate_block_participants, which can be used individually. Below, we first show the use of these underlying methods, but will use the abstraction to handle the data for later analysis needs.

Load All Clean Blocks

all_clean_blocks <- shlab.imgct::load_all_clean_blocks(datapath)

Example of a loaded clean block by selected the first of the list of loaded dataframes.

one_clean_block <- all_clean_blocks[[1]]

knitr::kable(
  one_clean_block
)
participant_id IAPS_2045.jpg IAPS_7270.jpg OASIS_car_race_1.jpg NAPS_BE_objects_033_h.jpg IAPS_3550.jpg NAPS_BE_objects_197_v.jpg IAPS_4300.jpg OASIS_doctor_5.jpg IAPS_2050.jpg IAPS_6231.jpg NAPS_BE_objects_116_v.jpg IAPS_5940.jpg IAPS_3062.jpg NAPS_BE_faces_118_h.jpg NAPS_BE_animals_029_v.jpg NAPS_BE_faces_128_h.jpg NAPS_BE_faces_219_v.jpg OASIS_fireworks_3.jpg NAPS_BE_people_142_h.jpg IAPS_5040.jpg NAPS_BE_people_054_h.jpg NAPS_BE_faces_367_h.jpg OASIS_bark_6.jpg IAPS_6825.jpg OASIS_excited_face_5.jpg NAPS_BE_faces_137_h.jpg OASIS_monkey_3.jpg IAPS_8620.jpg IAPS_1033.jpg NAPS_BE_animals_038_h.jpg NAPS_BE_people_015_h.jpg OASIS_gargoyle_2.jpg IAPS_7620.jpg OASIS_frustrated_pose_8.jpg NAPS_BE_animals_124_v.jpg OASIS_alcohol_1.jpg IAPS_1900.jpg NAPS_BE_faces_301_h.jpg IAPS_7705.jpg IAPS_2270.jpg IAPS_2095.jpg NAPS_BE_faces_163_h.jpg NAPS_BE_people_153_h.jpg IAPS_9110.jpg OASIS_car_race_2.jpg NAPS_BE_animals_051_h.jpg OASIS_sidewalk_3.jpg NAPS_BE_landscapes_118_v.jpg OASIS_rocks_6.jpg IAPS_8540.jpg NAPS_ERO_male_couple_025_v.jpg NAPS_ERO_female_couple_025_h.jpg NAPS_BE_faces_339_h.jpg OASIS_skydiving_3.jpg NAPS_BE_faces_203_h.jpg NAPS_BE_faces_015_h.jpg IAPS_9220.jpg NAPS_BE_animals_090_h.jpg NAPS_BE_people_154_h.jpg IAPS_1390.jpg IAPS_7180.jpg IAPS_7489.jpg NAPS_BE_landscapes_020_h.jpg NAPS_ERO_female_couple_046_h.jpg OASIS_tornado_2.jpg OASIS_woods_1.jpg OASIS_bear_2.jpg NAPS_BE_animals_033_h.jpg NAPS_BE_people_232_h.jpg IAPS_9469.jpg OASIS_roofing_2.jpg IAPS_7140.jpg NAPS_BE_people_048_h.jpg NAPS_BE_landscapes_034_h.jpg IAPS_3180.jpg NAPS_BE_faces_107_h.jpg OASIS_flowers_3.jpg NAPS_BE_objects_096_v.jpg OASIS_child_labor_2.jpg NAPS_BE_objects_263_h.jpg OASIS_doctor_8.jpg NAPS_BE_objects_176_v.jpg NAPS_BE_faces_237_v.jpg IAPS_6838.jpg IAPS_8371.jpg IAPS_1750.jpg NAPS_BE_objects_144_h.jpg NAPS_ERO_opposite-sex_couple_002_h.jpg IAPS_2410.jpg IAPS_7700.jpg OASIS_sunset_2.jpg OASIS_gazing_7.jpg NAPS_BE_landscapes_067_h.jpg OASIS_pinecone_1.jpg OASIS_tornado_5.jpg OASIS_excited_face_6.jpg NAPS_ERO_male_couple_037_v.jpg NAPS_BE_landscapes_083_h.jpg NAPS_BE_faces_168_h.jpg OASIS_railroad_1.jpg NAPS_BE_people_164_h.jpg IAPS_2224.jpg IAPS_8032.jpg NAPS_BE_faces_345_h.jpg OASIS_wedding_2.jpg OASIS_traffic_1.jpg IAPS_7405.jpg validation5-01.jpg IAPS_1660.jpg OASIS_lion_1.jpg NAPS_BE_faces_155_h.jpg validation5-02.jpg IAPS_7041.jpg NAPS_BE_faces_282_h.jpg NAPS_BE_people_136_h.jpg NAPS_BE_people_023_h.jpg NAPS_BE_people_013_v.jpg OASIS_flowers_1.jpg IAPS_3071.jpg IAPS_7034.jpg NAPS_BE_faces_063_v.jpg IAPS_7497.jpg validation5-03.jpg NAPS_BE_landscapes_092_h.jpg IAPS_3068.jpg IAPS_4534.jpg IAPS_8461.jpg NAPS_BE_landscapes_089_h.jpg IAPS_9160.jpg OASIS_rafting_1.jpg OASIS_dirt_5.jpg IAPS_2217.jpg IAPS_4698.jpg NAPS_BE_people_037_h.jpg IAPS_5215.jpg IAPS_8260.jpg NAPS_ERO_male_couple_032_h.jpg IAPS_5831.jpg IAPS_9810.jpg IAPS_9913.jpg NAPS_BE_faces_210_h.jpg IAPS_8250.jpg OASIS_dog_1.jpg OASIS_dog_21.jpg IAPS_7440.jpg NAPS_BE_faces_121_h.jpg NAPS_BE_objects_311_h.jpg IAPS_9140.jpg NAPS_BE_people_080_h.jpg OASIS_mother_1.jpg NAPS_ERO_opposite-sex_couple_013_h.jpg IAPS_8160.jpg IAPS_2352.jpg OASIS_dessert_6.jpg OASIS_neutral_face_4.jpg NAPS_BE_people_173_h.jpg OASIS_yoga_4.jpg validation5-04.jpg IAPS_8502.jpg OASIS_frustrated_pose_2.jpg NAPS_BE_faces_234_h.jpg IAPS_5660.jpg IAPS_1617.jpg NAPS_BE_objects_259_h.jpg OASIS_excited_face_7.jpg OASIS_tumor_1.jpg NAPS_BE_faces_132_h.jpg IAPS_5982.jpg IAPS_1310.jpg IAPS_2250.jpg NAPS_ERO_female_couple_018_h.jpg OASIS_picnic_1.jpg IAPS_2394.jpg NAPS_BE_landscapes_176_h.jpg NAPS_BE_faces_167_v.jpg IAPS_3000.jpg NAPS_BE_people_245_v.jpg OASIS_sunset_1.jpg NAPS_BE_objects_112_h.jpg NAPS_BE_objects_055_v.jpg NAPS_BE_animals_083_h.jpg NAPS_BE_landscapes_038_h.jpg OASIS_memorial_1.jpg OASIS_flowers_7.jpg IAPS_2681.jpg NAPS_BE_faces_353_h.jpg IAPS_6510.jpg IAPS_9635.1.jpg OASIS_graveyard_3.jpg NAPS_BE_people_207_v.jpg IAPS_7640.jpg IAPS_7030.jpg OASIS_nude_woman_12.jpg IAPS_4649.jpg NAPS_BE_faces_195_v.jpg NAPS_BE_people_155_h.jpg NAPS_BE_objects_302_h.jpg NAPS_BE_faces_024_h.jpg validation5-05.jpg IAPS_7710.jpg OASIS_rocks_7.jpg NAPS_BE_animals_047_h.jpg IAPS_9041.jpg NAPS_BE_landscapes_146_h.jpg NAPS_BE_landscapes_154_h.jpg
ICT_001 1 5 4 4 1 3 1 1 1 1 3 5 1 1 2 1 1 4 1 2 1 1 2 1 1 1 2 1 2 2 1 3 3 3 2 3 2 1 3 1 1 1 2 3 4 2 3 5 3 1 1 1 1 1 1 1 4 4 4 2 4 3 4 1 5 5 2 2 1 3 3 3 1 4 1 1 2 3 1 3 4 3 1 1 3 2 4 1 4 4 4 1 3 2 5 1 1 3 1 4 1 1 1 1 3 4 3 1 2 2 1 4 3 1 1 5 3 2 1 3 1 4 3 3 1 1 1 4 1 4 3 4 1 1 4 1 1 4 4 3 1 3 2 2 3 1 3 2 3 1 1 4 1 3 1 1 1 2 3 1 1 4 2 3 1 1 1 4 2 1 1 1 1 4 1 1 1 4 2 3 2 4 4 2 5 1 1 5 4 1 4 3 1 1 1 1 3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 4 3 3 1 4 1 1 2 3 1 3 1 3 1 1 3 2 5 1 1 3 4 1 4 2 4 1 1 3 1 4 1 1 1 1 3 4 3 1 2 2 1 4 3 1 1 1 3 2 1 3 1 4 3 4 1 1 1 4 1 1 4 1 1 1 4 1 1 1 1 1 1 3 2 2 3 1 3 2 1 1 1 1 1 3 1 1 1 2 3 1 1 4 2 3 1 1 1 4 2 1 1 1 1 4 1 1 1 3 3 3 2 4 4 2 1 1 1 1 3 1 4 3 1 1 1 5 3 1 5 3 4 2 1 4 4
ICT_010 1 3 3 3 1 3 1 1 1 1 3 4 1 1 2 1 1 4 1 2 1 1 3 1 1 1 2 1 2 2 1 3 4 1 2 3 2 1 3 1 1 1 1 3 4 2 4 4 3 1 1 1 1 1 1 1 1 2 1 2 4 3 4 1 4 4 2 2 1 4 3 3 1 4 1 1 2 3 1 3 1 3 1 1 1 2 4 1 1 4 4 4 4 2 4 1 1 4 1 4 1 1 1 1 1 4 3 1 2 2 1 4 3 1 1 1 4 2 1 3 1 1 3 4 1 1 1 4 1 1 4 1 1 1 4 1 1 1 1 1 1 1 2 2 3 1 3 2 1 1 1 1 1 3 1 1 1 2 3 1 1 4 2 3 1 1 1 4 2 1 1 1 1 4 1 1 1 4 2 3 2 4 4 2 1 1 1 1 4 1 4 3 1 1 1 1 3 0 5 4 4 2 1 4 4

Load the Validation Key

This method loads a TXT key that is used to compare participant responses to images specified for validation during the task.

validation_key <- shlab.imgct::load_key(datapath, "validation_key.txt")

What does this key look like when loaded?

knitr::kable(
  validation_key
)
validation5-01.jpg validation5-02.jpg validation5-03.jpg validation5-04.jpg validation5-05.jpg
1 4 3 2 5

Validate a Clean Block

Here, we show how to validate a single clean block of participant responses against the validation key.

one_validated_block <- shlab.imgct::validate_block_participants(one_clean_block, validation_key)

knitr::kable(
  one_validated_block
)
participant_id validation5-01.jpg validation5-02.jpg validation5-03.jpg validation5-04.jpg validation5-05.jpg total_valid
ICT_001 1 4 3 2 5 5
ICT_002 2 1 1 2 5 2
ICT_003 2 1 1 3 5 1
ICT_004 2 4 3 2 5 4
ICT_005 2 1 3 2 5 3
ICT_006 1 4 3 2 5 5
ICT_007 2 4 3 2 5 4
ICT_008 1 4 3 2 5 5
ICT_009 1 4 3 2 5 5
ICT_010 1 4 3 2 5 5

Validate All Participants

Using a similar procedure as above, all clean blocks of participant responses can be validated by validate_all_participants, which will also save a TSV to file.

shlab.imgct::validate_all_participants(datapath, key_filename = "validation_key.txt")