The mex repository provides an R pacakge and a collection of modular
Python scripts used in the experimental study of
Karapanagiotis, Krause & Krick (n.d.).
The study examines the usage of face reading technology in
improving preference prediction from self-reports using
micro expressions.
The analysis of the study was conducted using
PostgreSQL server 16.3,
Python version 3.10.12,
and R version 4.1.2. Python is used to
create a small SQL database from the CSV data file of the experiment and
fit the ANN models of the study. The accuracy statistics of the fitted ANN
models are stored in a portable SQLite database.
The Python code imports the packages configparser, logging,
matplotlib, numpy, pandas, psycopg2, scipy, sqlite3, sys,
and tensorflow. The R code is used for the statistical
analysis of the study. It imports the libraries crayon,
DBI, dplyr, e1071, gbm, ggplot2, glmnet, ini, keras,
leaps, MASS, patchwork, pls, randomForest, RPostgres,
stargazer, tensorflow, and tree.
The computations were conducted on:
-
Groningen University's Habrok cluster in a node with:
- two Intel Xeon Platinum 8358 CPUs
- four Nvidia A100 GPU accelerator cards 40 GB RAM
-
SAFE Leibniz Institute's computing cluster with:
- two AMD EPYC 7763 64-Core CPUs
- two Nvidia A100 GPU 40 GB RAM
The code is also tested with AMD's TensorFlow on ROCm 6.3.1 docker container.
To replicate the results
- Install the required dependencies.
- Download the study's data set
Study2_noldus_v5.csvand store it in the repository folder. Download the$k$ -fold validation fits of the ANN modelsann-accuracies.db. - Create a user for the database using
Replace the
CREATE ROLE mex WITH LOGIN PASSWORD '<user_password>';<user_password>placeholder with your credentials. Create an empty database called mex with owneruser_name. E.g., from apsqlshell execute as the root userCREATE DATABASE mex WITH OWNER = mex; - In the repository folder, create a file named
microexpressions.iniwith the following content:Replace the placeholders[postgresql] host=<hostname> dbname=mex user=mex password=<user_password> [logging] file=stdout [sources24] noldus=</full/path/to/>Study1_noldus_v4.csv [data24] accuracies=</full/path/to/>ann-accuracies.db<hostname>and<user_password>with the hostname and password of your installation. Replace the</full/path/to/>placeholders with the path to the root directory of the repository. - Execute the Python script
src/database.pyfrom thesrcfolder. E.g., in the command line or bash terminal useThis will create and populate the database tables using thepython database.pysql/tables-create.sql. In the same file, you can find the documentation of the database tables. - Go to folder subdirectory
vignettes. Render the manuscript and web appendix's results withquarto render manuscript.qmd -t html quarto render appendix.qmd -t html
To re-estimate the ANN-models (this is computationally intensive
and has been used with 40 GB of VRAM), you can use the
bash script src/mex.sh. You need to set
the SLURM variables
--partition and --gpus-per-node at the beginning of the
script.
Feel free to share and distribute.
The code is distributed under the Expat License.
Karapanagiotis Pantelis, Krause Franziska, and Krick Janina. (n.d.). “Face Reading Technology: Improving Preference Prediction from Self-Reports Using Micro Expressions”. Working Paper. .