Updated battery feature and its testing for periodic

pull/114/head
abhineethreddyk 2021-01-31 20:24:43 -05:00
parent 91168dac0d
commit dbf57f43f3
2 changed files with 8 additions and 6 deletions

View File

@ -26,6 +26,7 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se
# for discharge episodes # for discharge episodes
battery_discharge_episodes = battery_episodes[(battery_episodes["battery_status"] == 3) | (battery_episodes["battery_status"] == 4)] battery_discharge_episodes = battery_episodes[(battery_episodes["battery_status"] == 3) | (battery_episodes["battery_status"] == 4)]
battery_discharge_episodes = battery_discharge_episodes[battery_discharge_episodes['battery_consumption_rate'] !=0 ]
battery_discharge_features = pd.DataFrame() battery_discharge_features = pd.DataFrame()
if "countdischarge" in features_to_compute: if "countdischarge" in features_to_compute:
battery_discharge_features["countdischarge"] = battery_discharge_episodes.groupby(["local_segment"])["episode_id"].count() battery_discharge_features["countdischarge"] = battery_discharge_episodes.groupby(["local_segment"])["episode_id"].count()
@ -38,6 +39,7 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se
# for charge episodes # for charge episodes
battery_charge_episodes = battery_episodes[(battery_episodes["battery_status"] == 2) | (battery_episodes["battery_status"] == 5)] battery_charge_episodes = battery_episodes[(battery_episodes["battery_status"] == 2) | (battery_episodes["battery_status"] == 5)]
battery_charge_episodes = battery_charge_episodes[battery_charge_episodes['battery_consumption_rate'] !=0 ]
battery_charge_features = pd.DataFrame() battery_charge_features = pd.DataFrame()
if "countcharge" in features_to_compute: if "countcharge" in features_to_compute:
battery_charge_features["countcharge"] = battery_charge_episodes.groupby(["local_segment"])["episode_id"].count() battery_charge_features["countcharge"] = battery_charge_episodes.groupby(["local_segment"])["episode_id"].count()
@ -50,4 +52,4 @@ def rapids_features(sensor_data_files, time_segment, provider, filter_data_by_se
battery_features.index.rename("local_segment", inplace=True) battery_features.index.rename("local_segment", inplace=True)
battery_features = battery_features.reset_index() battery_features = battery_features.reset_index()
return battery_features return battery_features

View File

@ -1,6 +1,6 @@
"local_segment","local_segment_label","local_segment_start_datetime","local_segment_end_datetime","phone_battery_rapids_countdischarge","phone_battery_rapids_sumdurationdischarge","phone_battery_rapids_avgconsumptionrate","phone_battery_rapids_maxconsumptionrate","phone_battery_rapids_countcharge","phone_battery_rapids_sumdurationcharge" "local_segment","local_segment_label","local_segment_start_datetime","local_segment_end_datetime","phone_battery_rapids_countdischarge","phone_battery_rapids_sumdurationdischarge","phone_battery_rapids_avgconsumptionrate","phone_battery_rapids_maxconsumptionrate","phone_battery_rapids_countcharge","phone_battery_rapids_sumdurationcharge"
"afternoon#2020-07-01 12:00:00,2020-07-01 17:59:59","afternoon","2020-07-01 12:00:00","2020-07-01 17:59:59",3,72.1543666666666,0.110607001356668,0.253301361072647,2,79.4708833333333 "afternoon#2020-07-01 12:00:00,2020-07-01 17:59:59","afternoon","2020-07-01 12:00:00","2020-07-01 17:59:59",2,42.1548666666667,0.165910502035002,0.253301361072647,2,79.4708833333333
"daily#2020-07-01 00:00:00,2020-07-01 23:59:59","daily","2020-07-01 00:00:00","2020-07-01 23:59:59",10,354.814433333333,0.0460723079161749,0.0809973837845038,5,199.701516666667 "daily#2020-07-01 00:00:00,2020-07-01 23:59:59","daily","2020-07-01 00:00:00","2020-07-01 23:59:59",6,234.816433333333,0.0767871798602915,0.0809973837845038,5,199.701516666667
"evening#2020-07-01 18:00:00,2020-07-01 23:59:59","evening","2020-07-01 18:00:00","2020-07-01 23:59:59",3,105.130116666667,0.0443305579467856,0.079525673538274,1,37.5236666666667 "evening#2020-07-01 18:00:00,2020-07-01 23:59:59","evening","2020-07-01 18:00:00","2020-07-01 23:59:59",2,75.1306166666666,0.0664958369201784,0.079525673538274,1,37.5236666666667
"morning#2020-07-01 06:00:00,2020-07-01 11:59:59","morning","2020-07-01 06:00:00","2020-07-01 11:59:59",3,105.56345,0.0436773097317394,0.0731286084397727,2,42.61665 "morning#2020-07-01 06:00:00,2020-07-01 11:59:59","morning","2020-07-01 06:00:00","2020-07-01 11:59:59",2,75.56395,0.065515964597609,0.0731286084397727,2,42.61665
"night#2020-07-01 00:00:00,2020-07-01 05:59:59","night","2020-07-01 00:00:00","2020-07-01 05:59:59",3,71.9664666666666,0.158782604300746,0.400338953647421,1,40.0903 "night#2020-07-01 00:00:00,2020-07-01 05:59:59","night","2020-07-01 00:00:00","2020-07-01 05:59:59",2,41.9669666666667,0.23817390645112,0.400338953647421,1,40.0903

1 local_segment local_segment_label local_segment_start_datetime local_segment_end_datetime phone_battery_rapids_countdischarge phone_battery_rapids_sumdurationdischarge phone_battery_rapids_avgconsumptionrate phone_battery_rapids_maxconsumptionrate phone_battery_rapids_countcharge phone_battery_rapids_sumdurationcharge
2 afternoon#2020-07-01 12:00:00,2020-07-01 17:59:59 afternoon 2020-07-01 12:00:00 2020-07-01 17:59:59 3 2 72.1543666666666 42.1548666666667 0.110607001356668 0.165910502035002 0.253301361072647 2 79.4708833333333
3 daily#2020-07-01 00:00:00,2020-07-01 23:59:59 daily 2020-07-01 00:00:00 2020-07-01 23:59:59 10 6 354.814433333333 234.816433333333 0.0460723079161749 0.0767871798602915 0.0809973837845038 5 199.701516666667
4 evening#2020-07-01 18:00:00,2020-07-01 23:59:59 evening 2020-07-01 18:00:00 2020-07-01 23:59:59 3 2 105.130116666667 75.1306166666666 0.0443305579467856 0.0664958369201784 0.079525673538274 1 37.5236666666667
5 morning#2020-07-01 06:00:00,2020-07-01 11:59:59 morning 2020-07-01 06:00:00 2020-07-01 11:59:59 3 2 105.56345 75.56395 0.0436773097317394 0.065515964597609 0.0731286084397727 2 42.61665
6 night#2020-07-01 00:00:00,2020-07-01 05:59:59 night 2020-07-01 00:00:00 2020-07-01 05:59:59 3 2 71.9664666666666 41.9669666666667 0.158782604300746 0.23817390645112 0.400338953647421 1 40.0903