Impute phone and sms NAs with 0
parent
3f7ec80c18
commit
86299d346b
|
@ -88,9 +88,8 @@ 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)
|
features <- call_features_of_type(calls_of_type, features_type, call_type, time_segment, requested_features)
|
||||||
call_features <- merge(call_features, features, all=TRUE)
|
call_features <- merge(call_features, features, all=TRUE)
|
||||||
}
|
}
|
||||||
# TODO: why isn't the next line properly replacing na values with 0
|
# Fill NA values with 0
|
||||||
call_features <- call_features %>% mutate_at(vars(contains("countmostfrequentcontact") | contains("distinctcontacts") | contains("count") | contains("sumduration") | contains("minduration") | contains("maxduration") | contains("meanduration") | contains("modeduration")), list( ~ replace_na(., 0)))
|
call_features <- call_features %>% mutate_all(~replace(., is.na(.), 0))
|
||||||
# TODO: check if NaN values are filled
|
|
||||||
call_features[is.na(call_features)] = 0
|
|
||||||
return(call_features)
|
return(call_features)
|
||||||
}
|
}
|
|
@ -65,9 +65,8 @@ rapids_features <- function(sensor_data_files, time_segment, provider){
|
||||||
features <- message_features_of_type(messages_of_type, message_type, time_segment, requested_features)
|
features <- message_features_of_type(messages_of_type, message_type, time_segment, requested_features)
|
||||||
messages_features <- merge(messages_features, features, all=TRUE)
|
messages_features <- merge(messages_features, features, all=TRUE)
|
||||||
}
|
}
|
||||||
# TODO: why isn't the next line properly replacing na values with 0
|
# Fill NA values with 0
|
||||||
messages_features <- messages_features %>% mutate_at(vars(contains("countmostfrequentcontact") | contains("distinctcontacts") | contains("count")), list( ~ replace_na(., 0)))
|
messages_features <- messages_features %>% mutate_all(~replace(., is.na(.), 0))
|
||||||
# TODO: check if NaN values are filled
|
|
||||||
messages_features[is.na(messages_features)] = 0
|
|
||||||
return(messages_features)
|
return(messages_features)
|
||||||
}
|
}
|
Loading…
Reference in New Issue