text_html_output_1.png text_plain_output_1.png
from sklearn.metrics import classification_report,confusion_matrix,accuracy_score,roc_auc_score,roc_curve,ConfusionMatrixDisplay,RocCurveDisplay

import matplotlib.pyplot as plt

import pandas as pd

stimulus=pd.read_excel("/kaggle/input/young-adults-affective-data-ecg-and-gsr-signals/ECG_GSR_Emotions/Stimulus_Description.xlsx")
stimulus["Target Emotion"]=stimulus["Target Emotion"].str.title()
stimulus.info()
stimulus.head()

gsr_data = pd.read_excel('/kaggle/input/young-adults-affective-data-ecg-and-gsr-signals/ECG_GSR_Emotions/Self-Annotation Labels/Self-annotation Multimodal_Use.xlsx')
gsr_data['filename'] = 'GSRdata_s' + gsr_data['Session ID'].astype(str) + 'p' + gsr_data['Participant Id'].astype(str) + 'v' + gsr_data['Video ID'].astype(str) + '.dat'
PATH_2 = '/kaggle/input/young-adults-affective-data-ecg-and-gsr-signals/ECG_GSR_Emotions/Raw Data/Multimodal/GSR/'
gsr_data['filename'] = gsr_data['filename'].str.replace('GSRdata_s2p9v3.dat', 'GSRdata_S2p9v3.dat', regex=False)
gsr_data['GSR_list'] = gsr_data['filename'].apply(lambda x: list(pd.read_table(PATH_2 + x).iloc[:, 0]))
gsr_data = gsr_data.merge(stimulus.iloc[:, 0:3], on=['Session ID', 'Video ID'])
gsr_data.to_csv('gsr_data.csv', index=False)

gsr_data = pd.read_csv('/kaggle/working/gsr_data.csv')

emos = ['Happy', 'Mixed', 'Sad', 'Surprise', 'Fear', 'Disgust', 'Neutral', 'Anger']
cm = confusion_matrix(gsr_data['Target Emotion'], gsr_data['Emotion'], labels=emos)
ConfusionMatrixDisplay(confusion_matrix=cm, display_labels=emos).plot(cmap='YlGnBu')
plt.ylabel('Intended Video Emotion', fontsize=14)
plt.xlabel("Subject's Emotion after Watching", fontsize=14)
plt.show()