You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's Python script where the PageRank algorithm is modified to reflect an "ArgumentRank" approach. This modification adds the scores of supporting arguments and evidence and subtracts the scores of weakening arguments and evidence:
importnumpyasnpdefargumentrank(M, num_iterations: int=100, d: float=0.85):
"""ArgumentRank algorithm with explicit number of iterations. Returns ranking of nodes (arguments) in the adjacency matrix. Parameters ---------- M : numpy array adjacency matrix where M_i,j represents the link from 'j' to 'i', such that for all 'j' sum(i, M_i,j) != 0 (due to adding and subtracting) num_iterations : int, optional number of iterations, by default 100 d : float, optional damping factor, by default 0.85 Returns ------- numpy array a vector of ranks such that v_i is the i-th rank, v sums may not equal 1 due to addition and subtraction of arguments """N=M.shape[1]
v=np.ones(N) /NM_hat=d*M+ (1-d) /Nforiinrange(num_iterations):
v=np.dot(M_hat, v)
# Adjustments to ensure scores are not negative and sum to 1 after each iterationv=np.maximum(v, 0)
v/=v.sum()
returnv# Example adjacency matrix for argument linksM=np.array([[0, -0.5, 0, 0, 1],
[0.5, 0, -0.5, 0, 0],
[0.5, -0.5, 0, 0, 0],
[0, 1, 0.5, 0, -1],
[0, 0, 0.5, 1, 0]])
v=argumentrank(M, 100, 0.85)
print(v)
This edited script represents an "ArgumentRank" algorithm where the adjacency matrix M now accounts for both strengthening and weakening arguments. The matrix entries are adjusted to add scores for supporting arguments and subtract scores for weakening arguments. Additionally, after each iteration, the algorithm ensures that the scores are normalized (non-negative and sum to 1) to maintain a consistent ranking system.
help wantedIndicates that additional assistance, possibly from external contributors, is required.
1 participant
Converted from issue
This discussion was converted from issue #4 on November 20, 2023 03:01.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here's Python script where the PageRank algorithm is modified to reflect an "ArgumentRank" approach. This modification adds the scores of supporting arguments and evidence and subtracts the scores of weakening arguments and evidence:
This edited script represents an "ArgumentRank" algorithm where the adjacency matrix
M
now accounts for both strengthening and weakening arguments. The matrix entries are adjusted to add scores for supporting arguments and subtract scores for weakening arguments. Additionally, after each iteration, the algorithm ensures that the scores are normalized (non-negative and sum to 1) to maintain a consistent ranking system.Beta Was this translation helpful? Give feedback.
All reactions