ml_pr_vis

datavis.ml_pr_vis.clean_csv(csv_file)

Convert dictionary from directory keys to multi-level dictionary

Parameters:csv_file (dict) – Dictionary with directory keys
Returns:out_dict, with patient and directory_number keys
datavis.ml_pr_vis.make_emotion_data(emotion, short_patient)

Loads emotions and AUs from au_emotes.txt and spits out training/testing data for classification

Parameters:
  • emotion (str) – Emotion for training
  • short_patient (str) – Patient identifier

:returns au training/testing data, emotion training/testing

datavis.ml_pr_vis.thresh_calc(out_q, short_patient, thresh)

Calculate, based on probabilities in scores dict, confusion matrix for each emotion

Parameters:
  • out_q (Queue) – Queue to put confusion matrix dictionaries in
  • short_patient (str) – Patient identifier
  • thresh (int) – Threshold for emotion recognition
datavis.ml_pr_vis.use_classifier(classifier, au_train, au_test, target_train, target_test)

Fit the classifier on the training AUs and predict emotions

Parameters:
  • classifier – Classifier
  • au_train – Training action units
  • au_test – Testing action units
  • target_train – Training emotions
  • target_test – Testing emotions
Returns:

Testing emotions, predicted probabilities

datavis.ml_pr_vis.validate_thresh_dict(thresh_dict)

Helper function to validate that the thresh_dict has the correct ratio of true_post, false_pos, etc

Parameters:thresh_dict (dict) – Dict to validate
Raises:AssertionError
datavis.ml_pr_vis.vis(short_patient, thresh_file=None)

Visualize patient classification results for different classifiers

Parameters:
  • short_patient (str) – Patient to visualize
  • thresh_file (str) – Optional, txt file containing thresh data

:returns None, saves output in the format short_patient + ‘_{0}_pr_with_ML_and_pose’.format(emotion)