Skip to content

Commit

Permalink
feat: zeroing self interactions!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Mar 5, 2024
1 parent f62113b commit 60f668c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 9 additions & 2 deletions discord_analyzer/analysis/compute_interaction_matrix_discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# Author Ene SS Rawa / Tjitse van der Molen
from typing import Any
import copy
from tc_core_analyzer_lib.utils.activity import DiscordActivity
from discord_analyzer.DB_operations.mongodb_access import DB_access
from discord_analyzer.DB_operations.mongodb_query import MongodbQuery
from numpy import ndarray
from tc_core_analyzer_lib.utils.activity import DiscordActivity
from numpy import ndarray, diag_indices_from

from .utils.compute_interaction_mtx_utils import (
generate_interaction_matrix,
Expand Down Expand Up @@ -94,6 +94,13 @@ def compute_interaction_matrix_discord(
acc_names=acc_names,
activities=[activity],
)
# a person interacting to themselves is not counted as activity
if activity in [
DiscordActivity.Reply,
DiscordActivity.Reaction,
DiscordActivity.Mention,
]:
int_mat[activity][diag_indices_from(int_mat[activity])] = 0

return int_mat

Expand Down
5 changes: 0 additions & 5 deletions discord_analyzer/analysis/compute_member_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,6 @@ def compute_member_activity(
acc_names, date_list_w_str, channels, db_access
)

# # for each int_mat type
# for key in list(int_mat.keys()):
# # remove interactions with self
# int_mat[key][np.diag_indices_from(int_mat[key])] = 0

# assess engagement
(graph_out, *activity_dict) = assess_engagment.compute(
int_mat=int_mat,
Expand Down

0 comments on commit 60f668c

Please sign in to comment.