Skip to content

pi-kappa-devel/mex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preference Prediction Using Micro Expressions

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.

Dependencies

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.

Replication

The computations were conducted on:

  1. Groningen University's Habrok cluster in a node with:

    • two Intel Xeon Platinum 8358 CPUs
    • four Nvidia A100 GPU accelerator cards 40 GB RAM
  2. 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

  1. Install the required dependencies.
  2. Download the study's data set Study2_noldus_v5.csv and store it in the repository folder. Download the $k$-fold validation fits of the ANN models ann-accuracies.db.
  3. Create a user for the database using
    CREATE ROLE mex WITH LOGIN PASSWORD '<user_password>';
    
    Replace the <user_password> placeholder with your credentials. Create an empty database called mex with owner user_name. E.g., from a psql shell execute as the root user
    CREATE DATABASE mex WITH OWNER = mex;
    
  4. In the repository folder, create a file named microexpressions.ini with the following content:
    [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
    
    Replace the placeholders <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.
  5. Execute the Python script src/database.py from the src folder. E.g., in the command line or bash terminal use
    python database.py
    
    This will create and populate the database tables using the sql/tables-create.sql. In the same file, you can find the documentation of the database tables.
  6. Go to folder subdirectory vignettes. Render the manuscript and web appendix's results with
    quarto 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.

Contributors

Pantelis Karapanagiotis

Feel free to share and distribute.

License

The code is distributed under the Expat License.

References

Karapanagiotis Pantelis, Krause Franziska, and Krick Janina. (n.d.). “Face Reading Technology: Improving Preference Prediction from Self-Reports Using Micro Expressions”. Working Paper. .