From 6a5470e338f22a22e64bf7697312174ddbca289b Mon Sep 17 00:00:00 2001 From: nikunjgoel95 Date: Sun, 23 Aug 2020 13:20:19 -0400 Subject: [PATCH] Splitting Energy Feature in Conversation to Voice and Noise. --- config.yaml | 5 ++- .../conversation/conversation_base.py | 41 +++++++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/config.yaml b/config.yaml index c40a2e02..a0cacb3d 100644 --- a/config.yaml +++ b/config.yaml @@ -199,8 +199,9 @@ CONVERSATION: IOS: plugin_studentlife_audio DAY_SEGMENTS: *day_segments FEATURES: ["minutessilence", "minutesnoise", "minutesvoice", "minutesunknown","sumconversationduration","avgconversationduration", - "sdconversationduration","minconversationduration","maxconversationduration","timefirstconversation","timelastconversation","sumenergy", - "avgenergy","sdenergy","minenergy","maxenergy","silencesensedfraction","noisesensedfraction", + "sdconversationduration","minconversationduration","maxconversationduration","timefirstconversation","timelastconversation","noisesumenergy", + "noiseavgenergy","noisesdenergy","noiseminenergy","noisemaxenergy","voicesumenergy", + "voiceavgenergy","voicesdenergy","voiceminenergy","voicemaxenergy","silencesensedfraction","noisesensedfraction", "voicesensedfraction","unknownsensedfraction","silenceexpectedfraction","noiseexpectedfraction","voiceexpectedfraction", "unknownexpectedfraction","countconversation"] RECORDINGMINUTES: 1 diff --git a/src/features/conversation/conversation_base.py b/src/features/conversation/conversation_base.py index eb00c64b..6c50919a 100644 --- a/src/features/conversation/conversation_base.py +++ b/src/features/conversation/conversation_base.py @@ -3,8 +3,9 @@ import pandas as pd def base_conversation_features(conversation_data, day_segment, requested_features,recordingMinutes,pausedMinutes,expectedMinutes): # name of the features this function can compute base_features_names = ["minutessilence", "minutesnoise", "minutesvoice", "minutesunknown","sumconversationduration","avgconversationduration", - "sdconversationduration","minconversationduration","maxconversationduration","timefirstconversation","timelastconversation","sumenergy", - "avgenergy","sdenergy","minenergy","maxenergy","silencesensedfraction","noisesensedfraction", + "sdconversationduration","minconversationduration","maxconversationduration","timefirstconversation","timelastconversation","noisesumenergy", + "noiseavgenergy","noisesdenergy","noiseminenergy","noisemaxenergy","voicesumenergy", + "voiceavgenergy","voicesdenergy","voiceminenergy","voicemaxenergy","silencesensedfraction","noisesensedfraction", "voicesensedfraction","unknownsensedfraction","silenceexpectedfraction","noiseexpectedfraction","voiceexpectedfraction", "unknownexpectedfraction","countconversation"] @@ -96,22 +97,36 @@ def base_conversation_features(conversation_data, day_segment, requested_feature else: conversation_features["conversation_" + day_segment + "_timelastconversation"] = 0 - if "sumenergy" in features_to_compute: - conversation_features["conversation_" + day_segment + "_sumenergy"] = conversation_data.groupby(["local_date"])["double_energy"].sum() + if "noisesumenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_noisesumenergy"] = conversation_data[conversation_data['inference']==1].groupby(["local_date"])["double_energy"].sum() - if "avgenergy" in features_to_compute: - conversation_features["conversation_" + day_segment + "_avgenergy"] = conversation_data.groupby(["local_date"])["double_energy"].mean() + if "noiseavgenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_noiseavgenergy"] = conversation_data[conversation_data['inference']==1].groupby(["local_date"])["double_energy"].mean() - if "sdenergy" in features_to_compute: - conversation_features["conversation_" + day_segment + "_sdenergy"] = conversation_data.groupby(["local_date"])["double_energy"].std() + if "noisesdenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_noisesdenergy"] = conversation_data[conversation_data['inference']==1].groupby(["local_date"])["double_energy"].std() - if "minenergy" in features_to_compute: - conversation_features["conversation_" + day_segment + "_minenergy"] = conversation_data.groupby(["local_date"])["double_energy"].min() + if "noiseminenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_noiseminenergy"] = conversation_data[conversation_data['inference']==1].groupby(["local_date"])["double_energy"].min() - if "maxenergy" in features_to_compute: - conversation_features["conversation_" + day_segment + "_maxenergy"] = conversation_data.groupby(["local_date"])["double_energy"].max() + if "noisemaxenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_noisemaxenergy"] = conversation_data[conversation_data['inference']==1].groupby(["local_date"])["double_energy"].max() + if "voicesumenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_voicesumenergy"] = conversation_data[conversation_data['inference']==2].groupby(["local_date"])["double_energy"].sum() + + if "voiceavgenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_voiceavgenergy"] = conversation_data[conversation_data['inference']==2].groupby(["local_date"])["double_energy"].mean() + + if "voicesdenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_voicesdenergy"] = conversation_data[conversation_data['inference']==2].groupby(["local_date"])["double_energy"].std() + + if "voiceminenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_voiceminenergy"] = conversation_data[conversation_data['inference']==2].groupby(["local_date"])["double_energy"].min() + + if "voicemaxenergy" in features_to_compute: + conversation_features["conversation_" + day_segment + "_voicemaxenergy"] = conversation_data[conversation_data['inference']==2].groupby(["local_date"])["double_energy"].max() conversation_features = conversation_features.reset_index() - + return conversation_features \ No newline at end of file