Skip to content

Commit

Permalink
update: updated the act_param usage!
Browse files Browse the repository at this point in the history
the act_param should be a dictionary as input from now on.
  • Loading branch information
amindadgar committed Oct 17, 2023
1 parent 2b8c579 commit fb682bc
Showing 1 changed file with 43 additions and 42 deletions.
85 changes: 43 additions & 42 deletions tc_core_analyzer_lib/assess_engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
---------
Expand All @@ -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,
Expand All @@ -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 # # #
Expand All @@ -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,
)
Expand All @@ -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,
)
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit fb682bc

Please sign in to comment.