diff --git a/src/features/empatica_data_yield.py b/src/features/empatica_data_yield.py index cc9c491d..ebc9f59d 100644 --- a/src/features/empatica_data_yield.py +++ b/src/features/empatica_data_yield.py @@ -21,9 +21,3 @@ def calculate_empatica_data_yield(features): features.drop(empatica_data_yield_cols, axis=1, inplace=True) # In case of if the advanced operations will later not be needed (e.g., weighted average) return features - - - - - - diff --git a/src/features/phone_calls/rapids/main.R b/src/features/phone_calls/rapids/main.R index f9f41060..5b75e2ea 100644 --- a/src/features/phone_calls/rapids/main.R +++ b/src/features/phone_calls/rapids/main.R @@ -88,6 +88,14 @@ rapids_features <- function(sensor_data_files, time_segment, provider){ features <- call_features_of_type(calls_of_type, features_type, call_type, time_segment, requested_features) call_features <- merge(call_features, features, all=TRUE) } + + # Fill seleted columns with a high number + time_cols <- select(call_features, contains("timefirstcall") | contains("timelastcall")) %>% + colnames(.) + + call_features <- call_features %>% + mutate_at(., time_cols, ~replace(., is.na(.), 1000000)) + # Fill NA values with 0 call_features <- call_features %>% mutate_all(~replace(., is.na(.), 0)) diff --git a/src/features/phone_messages/rapids/main.R b/src/features/phone_messages/rapids/main.R index 4a43a664..9db9a4b6 100644 --- a/src/features/phone_messages/rapids/main.R +++ b/src/features/phone_messages/rapids/main.R @@ -65,6 +65,13 @@ rapids_features <- function(sensor_data_files, time_segment, provider){ features <- message_features_of_type(messages_of_type, message_type, time_segment, requested_features) messages_features <- merge(messages_features, features, all=TRUE) } + # Fill seleted columns with a high number + time_cols <- select(call_features, contains("timefirstmessages") | contains("timelastmessages")) %>% + colnames(.) + + call_features <- call_features %>% + mutate_at(., time_cols, ~replace(., is.na(.), 1000000)) + # Fill NA values with 0 messages_features <- messages_features %>% mutate_all(~replace(., is.na(.), 0)) diff --git a/src/features/phone_screen/rapids/main.py b/src/features/phone_screen/rapids/main.py index 26580640..a8d204d3 100644 --- a/src/features/phone_screen/rapids/main.py +++ b/src/features/phone_screen/rapids/main.py @@ -63,6 +63,7 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se if not screen_features.empty: screen_features.fillna(value={feature_name: 0 for feature_name in screen_features.columns if not feature_name.startswith(("stdduration", "firstuseafter"))}, inplace=True) + screen_features["firstuseafter"] = screen_features["firstuseafter"].fillna(1000000) screen_features = screen_features.reset_index() return screen_features