From fb682bc76351b683cb5a935bc4ab28369c3d73d6 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 17 Oct 2023 12:31:09 +0330 Subject: [PATCH 1/3] update: updated the act_param usage! the act_param should be a dictionary as input from now on. --- tc_core_analyzer_lib/assess_engagement.py | 85 ++++++++++++----------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/tc_core_analyzer_lib/assess_engagement.py b/tc_core_analyzer_lib/assess_engagement.py index 0dc09dd..02dd02a 100644 --- a/tc_core_analyzer_lib/assess_engagement.py +++ b/tc_core_analyzer_lib/assess_engagement.py @@ -95,35 +95,36 @@ def compute( containing a list of all account names belonging to engagement category * - act_param : list[int] + act_param : dict[str, int] parameters for activity types: - INT_THR : int - minimum number of interactions to be active - UW_DEG_THR : int - minimum number of connections to be active - EDGE_STR_THR : int - minimum number of interactions for connected - UW_THR_DEG_THR : int - minimum number of accounts for connected - CON_T_THR : int - time period to assess consistently active - CON_O_THR : int - times to be active within CON_T_THR to be - consistently active - VITAL_T_THR : int - time period to assess for vital - VITAL_O_THR : int - times to be connected within VITAL_T_THR to be vital - PAUSED_T_THR : int - time period to remain paused - STILL_T_THR : int - time period to assess for still active - STILL_O_THR : int - times to be active within STILL_T_THR to be still active - DROP_H_THR : int - time periods in the past to have been newly active - DROP_I_THR : int - time periods to have been inactive + keys are listed below + - INT_THR : int + minimum number of interactions to be active + - UW_DEG_THR : int + minimum number of connections to be active + - EDGE_STR_THR : int + minimum number of interactions for connected + - UW_THR_DEG_THR : int + minimum number of accounts for connected + - CON_T_THR : int + time period to assess consistently active + - CON_O_THR : int + times to be active within CON_T_THR to be + consistently active + - VITAL_T_THR : int + time period to assess for vital + - VITAL_O_THR : int + times to be connected within VITAL_T_THR to be vital + - PAUSED_T_THR : int + time period to remain paused + - STILL_T_THR : int + time period to assess for still active + - STILL_O_THR : int + times to be active within STILL_T_THR to be still active + - DROP_H_THR : int + time periods in the past to have been newly active + - DROP_I_THR : int + time periods to have been inactive Returns: --------- @@ -141,10 +142,10 @@ def compute( # # # THRESHOLD INTERACTIONS # # # thr_ind, thr_uw_deg, thr_uw_thr_deg, graph = thr_int( int_mat, - act_param[0], - act_param[1], - act_param[5], - act_param[6], + act_param["INT_THR"], + act_param["UW_DEG_THR"], + act_param["EDGE_STR_THR"], + act_param["UW_THR_DEG_THR"], activities=self.activities, ignore_axis_0_activities=self.activities_ignore_0_axis, ignore_axis_1_activities=self.activities_ignore_1_axis, @@ -161,13 +162,13 @@ def compute( # # # CONSISTENTLY ACTIVE # # # all_consistent = assess_consistent( - all_active, w_i, act_param[3], act_param[4], WINDOW_D, all_consistent + all_active, w_i, act_param["CON_T_THR"], act_param["CON_O_THR"], WINDOW_D, all_consistent ) # # # VITAL # # # all_vital = assess_vital( - all_connected, w_i, act_param[7], act_param[8], WINDOW_D, all_vital + all_connected, w_i, act_param["VITAL_T_THR"], act_param["VITAL_O_THR"], WINDOW_D, all_vital ) # # # STILL ACTIVE # # # @@ -176,8 +177,8 @@ def compute( all_new_active, all_active, w_i, - act_param[9], - act_param[10], + act_param["STILL_T_THR"], + act_param["STILL_O_THR"], WINDOW_D, all_still_active, ) @@ -188,8 +189,8 @@ def compute( all_new_active, all_active, w_i, - act_param[11], - act_param[12], + act_param["DROP_H_THR"], + act_param["DROP_I_THR"], WINDOW_D, all_dropped, ) @@ -208,7 +209,7 @@ def compute( all_active, w_i, WINDOW_D, - act_param[2], + act_param["PAUSED_T_THR"], all_new_active, all_unpaused, all_returned, @@ -245,7 +246,7 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_vital[str(w_i)], ) = assess_overlap( - all_new_disengaged, all_vital, w_i, (act_param[2] + 1) * WINDOW_D + all_new_disengaged, all_vital, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D ) # assess who of the remaining disengaged accounts @@ -254,7 +255,7 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_consistently_active[str(w_i)], ) = assess_overlap( - rem_new_disengaged, all_consistent, w_i, (act_param[2] + 1) * WINDOW_D + rem_new_disengaged, all_consistent, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D ) # assess who of the remaining disengaged accounts @@ -263,7 +264,7 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_newly_active[str(w_i)], ) = assess_overlap( - rem_new_disengaged, all_new_active, w_i, (act_param[2] + 1) * WINDOW_D + rem_new_disengaged, all_new_active, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D ) else: all_disengaged_were_vital[str(w_i)] = set() From 1e4274d581f8b5bd7b1346578f0bc776eba37f54 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Tue, 17 Oct 2023 12:34:24 +0330 Subject: [PATCH 2/3] Update: related tests and linter issues fixed! --- tc_core_analyzer_lib/assess_engagement.py | 29 +++++- .../tests/integration/test_active_members.py | 95 ++++++------------- .../test_all_active_fourteen_period.py | 46 +++------ .../integration/test_consistently_active.py | 46 +++------ .../integration/test_disengaged_members.py | 46 +++------ ...est_disengaged_were_consistently_active.py | 46 +++------ .../test_disengaged_were_newly_active.py | 46 +++------ .../integration/test_disengaged_were_vital.py | 46 +++------ ..._mention_active_members_from_int_matrix.py | 46 +++------ .../test_newly_active_continuous_period.py | 46 +++------ .../test_newly_active_discontinued_period.py | 46 +++------ .../test_non_consistently_active.py | 46 +++------ .../test_partially_consistently_active.py | 46 +++------ .../tests/integration/test_still_active.py | 46 +++------ .../tests/integration/test_vital.py | 46 +++------ 15 files changed, 249 insertions(+), 473 deletions(-) diff --git a/tc_core_analyzer_lib/assess_engagement.py b/tc_core_analyzer_lib/assess_engagement.py index 02dd02a..58a5752 100644 --- a/tc_core_analyzer_lib/assess_engagement.py +++ b/tc_core_analyzer_lib/assess_engagement.py @@ -162,13 +162,23 @@ def compute( # # # CONSISTENTLY ACTIVE # # # all_consistent = assess_consistent( - all_active, w_i, act_param["CON_T_THR"], act_param["CON_O_THR"], WINDOW_D, all_consistent + all_active, + w_i, + act_param["CON_T_THR"], + act_param["CON_O_THR"], + WINDOW_D, + all_consistent, ) # # # VITAL # # # all_vital = assess_vital( - all_connected, w_i, act_param["VITAL_T_THR"], act_param["VITAL_O_THR"], WINDOW_D, all_vital + all_connected, + w_i, + act_param["VITAL_T_THR"], + act_param["VITAL_O_THR"], + WINDOW_D, + all_vital, ) # # # STILL ACTIVE # # # @@ -246,7 +256,10 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_vital[str(w_i)], ) = assess_overlap( - all_new_disengaged, all_vital, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D + all_new_disengaged, + all_vital, + w_i, + (act_param["PAUSED_T_THR"] + 1) * WINDOW_D, ) # assess who of the remaining disengaged accounts @@ -255,7 +268,10 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_consistently_active[str(w_i)], ) = assess_overlap( - rem_new_disengaged, all_consistent, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D + rem_new_disengaged, + all_consistent, + w_i, + (act_param["PAUSED_T_THR"] + 1) * WINDOW_D, ) # assess who of the remaining disengaged accounts @@ -264,7 +280,10 @@ def compute( rem_new_disengaged[str(w_i)], all_disengaged_were_newly_active[str(w_i)], ) = assess_overlap( - rem_new_disengaged, all_new_active, w_i, (act_param["PAUSED_T_THR"] + 1) * WINDOW_D + rem_new_disengaged, + all_new_active, + w_i, + (act_param["PAUSED_T_THR"] + 1) * WINDOW_D, ) else: all_disengaged_were_vital[str(w_i)] = set() diff --git a/tc_core_analyzer_lib/tests/integration/test_active_members.py b/tc_core_analyzer_lib/tests/integration/test_active_members.py index 8000982..96843ce 100644 --- a/tc_core_analyzer_lib/tests/integration/test_active_members.py +++ b/tc_core_analyzer_lib/tests/integration/test_active_members.py @@ -45,39 +45,21 @@ def test_no_active(): # window index w_i = 0 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } activities = [ DiscordActivity.Reaction, @@ -165,38 +147,21 @@ def test_single_active(): WINDOW_D = 7 # window index w_i = 0 - - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } activities = [ DiscordActivity.Reaction, diff --git a/tc_core_analyzer_lib/tests/integration/test_all_active_fourteen_period.py b/tc_core_analyzer_lib/tests/integration/test_all_active_fourteen_period.py index 4250b6d..126faa5 100644 --- a/tc_core_analyzer_lib/tests/integration/test_all_active_fourteen_period.py +++ b/tc_core_analyzer_lib/tests/integration/test_all_active_fourteen_period.py @@ -11,37 +11,21 @@ def test_all_active_fourteen_period(): so we should have the users as active for the interaction matrix and not the window_d period here """ - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } analytics_length = 14 all_joined_day = dict( diff --git a/tc_core_analyzer_lib/tests/integration/test_consistently_active.py b/tc_core_analyzer_lib/tests/integration/test_consistently_active.py index 90e65fe..1129b28 100644 --- a/tc_core_analyzer_lib/tests/integration/test_consistently_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_consistently_active.py @@ -46,37 +46,21 @@ def test_two_consistently_active(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_disengaged_members.py b/tc_core_analyzer_lib/tests/integration/test_disengaged_members.py index d9f891d..ba1b7a2 100644 --- a/tc_core_analyzer_lib/tests/integration/test_disengaged_members.py +++ b/tc_core_analyzer_lib/tests/integration/test_disengaged_members.py @@ -43,37 +43,21 @@ def test_disengaged_members(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_consistently_active.py b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_consistently_active.py index face901..9fd21da 100644 --- a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_consistently_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_consistently_active.py @@ -43,37 +43,21 @@ def test_disengaged_were_consistent(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_newly_active.py b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_newly_active.py index 39d042d..526215c 100644 --- a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_newly_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_newly_active.py @@ -7,37 +7,21 @@ def test_disengaged_newly_active(): acc_names = [] acc_count = 5 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(5): acc_names.append(f"user{i}") diff --git a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_vital.py b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_vital.py index b58ea13..93e6c93 100644 --- a/tc_core_analyzer_lib/tests/integration/test_disengaged_were_vital.py +++ b/tc_core_analyzer_lib/tests/integration/test_disengaged_were_vital.py @@ -7,37 +7,21 @@ def test_disengaged_were_vital(): acc_names = [] acc_count = 10 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(acc_count): acc_names.append(f"user{i}") diff --git a/tc_core_analyzer_lib/tests/integration/test_mention_active_members_from_int_matrix.py b/tc_core_analyzer_lib/tests/integration/test_mention_active_members_from_int_matrix.py index 07f8f91..9601772 100644 --- a/tc_core_analyzer_lib/tests/integration/test_mention_active_members_from_int_matrix.py +++ b/tc_core_analyzer_lib/tests/integration/test_mention_active_members_from_int_matrix.py @@ -12,37 +12,21 @@ def test_mention_active_members_from_int_matrix(): acc_names = [] acc_count = 5 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(5): acc_names.append(f"user{i}") diff --git a/tc_core_analyzer_lib/tests/integration/test_newly_active_continuous_period.py b/tc_core_analyzer_lib/tests/integration/test_newly_active_continuous_period.py index 419df31..d1d2e39 100644 --- a/tc_core_analyzer_lib/tests/integration/test_newly_active_continuous_period.py +++ b/tc_core_analyzer_lib/tests/integration/test_newly_active_continuous_period.py @@ -46,37 +46,21 @@ def test_newly_active_continuous_period(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_newly_active_discontinued_period.py b/tc_core_analyzer_lib/tests/integration/test_newly_active_discontinued_period.py index 604b9a7..3a9826f 100644 --- a/tc_core_analyzer_lib/tests/integration/test_newly_active_discontinued_period.py +++ b/tc_core_analyzer_lib/tests/integration/test_newly_active_discontinued_period.py @@ -7,37 +7,21 @@ def test_newly_active_discontinued_period(): acc_names = [] acc_count = 5 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(5): acc_names.append(f"user{i}") diff --git a/tc_core_analyzer_lib/tests/integration/test_non_consistently_active.py b/tc_core_analyzer_lib/tests/integration/test_non_consistently_active.py index 7b1f03a..44494a6 100644 --- a/tc_core_analyzer_lib/tests/integration/test_non_consistently_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_non_consistently_active.py @@ -48,37 +48,21 @@ def test_two_consistently_active_non(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_partially_consistently_active.py b/tc_core_analyzer_lib/tests/integration/test_partially_consistently_active.py index 99a872c..0b5ee3a 100644 --- a/tc_core_analyzer_lib/tests/integration/test_partially_consistently_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_partially_consistently_active.py @@ -46,37 +46,21 @@ def test_two_consistently_active_partially(): } memberactivities = activity_dict.keys() - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } int_mat = { DiscordActivity.Reply: np.zeros((acc_count, acc_count)), diff --git a/tc_core_analyzer_lib/tests/integration/test_still_active.py b/tc_core_analyzer_lib/tests/integration/test_still_active.py index 0d05e8d..56a3768 100644 --- a/tc_core_analyzer_lib/tests/integration/test_still_active.py +++ b/tc_core_analyzer_lib/tests/integration/test_still_active.py @@ -8,37 +8,21 @@ def test_still_active_members(): acc_names = [] acc_count = 5 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(5): acc_names.append(f"user{i}") diff --git a/tc_core_analyzer_lib/tests/integration/test_vital.py b/tc_core_analyzer_lib/tests/integration/test_vital.py index fa00b94..01d426c 100644 --- a/tc_core_analyzer_lib/tests/integration/test_vital.py +++ b/tc_core_analyzer_lib/tests/integration/test_vital.py @@ -8,37 +8,21 @@ def test_one_vital(): acc_names = [] acc_count = 10 - INT_THR = 1 # minimum number of interactions to be active - UW_DEG_THR = 1 # minimum number of accounts interacted with to be active - PAUSED_T_THR = 1 # time period to remain paused - CON_T_THR = 4 # time period to be consistent active - CON_O_THR = 3 # time period to be consistent active - EDGE_STR_THR = 5 # minimum number of interactions for connected - UW_THR_DEG_THR = 5 # minimum number of accounts for connected - VITAL_T_THR = 4 # time period to assess for vital - VITAL_O_THR = 3 # times to be connected within VITAL_T_THR to be vital - STILL_T_THR = 2 # time period to assess for still active - STILL_O_THR = 2 # times to be active within STILL_T_THR to be still active - # time periods into the past (history) to be newly active for computing dropped - DROP_H_THR = 2 - # consecutive time periods into the past to have not been active for computing - DROP_I_THR = 1 - - act_param = [ - INT_THR, - UW_DEG_THR, - PAUSED_T_THR, - CON_T_THR, - CON_O_THR, - EDGE_STR_THR, - UW_THR_DEG_THR, - VITAL_T_THR, - VITAL_O_THR, - STILL_T_THR, - STILL_O_THR, - DROP_H_THR, - DROP_I_THR, - ] + act_param = { + "INT_THR": 1, + "UW_DEG_THR": 1, + "PAUSED_T_THR": 1, + "CON_T_THR": 4, + "CON_O_THR": 3, + "EDGE_STR_THR": 5, + "UW_THR_DEG_THR": 5, + "VITAL_T_THR": 4, + "VITAL_O_THR": 3, + "STILL_T_THR": 2, + "STILL_O_THR": 2, + "DROP_H_THR": 2, + "DROP_I_THR": 1, + } for i in range(acc_count): acc_names.append(f"user{i}") From 7bbe617c58886bcd9d4dd5b9621b7fa8902aff72 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Date: Thu, 30 Nov 2023 09:26:49 +0330 Subject: [PATCH 3/3] update: increase lib version! --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3520d5a..b934283 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="tc-core-analyzer-lib", - version="1.0.2", + version="1.1.0", author="Mohammad Amin Dadgar, TogetherCrew", maintainer="Mohammad Amin Dadgar", maintainer_email="dadgaramin96@gmail.com",