Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get best alignment #11

Open
LuisCastilloV98 opened this issue May 7, 2020 · 0 comments
Open

Get best alignment #11

LuisCastilloV98 opened this issue May 7, 2020 · 0 comments

Comments

@LuisCastilloV98
Copy link

I'm trying to add a code to alignments.py, to get the best alignment the alignment matrix doesn't work, but it doesn't work for me, I don't know if it finds the error and could you help me with it?

def get_best_alignment(alignment_matrix):
  n_nodes = alignment_matrix.shape[0]
  result = []
  if not sp.issparse(alignment_matrix):
      sorted_indices = np.argsort(alignment_matrix)
  for node_index in range(n_nodes):
    target_alignment = node_index #default: assume identity mapping, and the node should be aligned to itself      

    if sp.issparse(alignment_matrix):
          row, possible_alignments, possible_values = sp.find(alignment_matrix[node_index])
          node_sorted_indices = possible_alignments[possible_values.argsort()]
    else:
          node_sorted_indices = sorted_indices[node_index]

    result.append([target_alignment, node_sorted_indices[-1:][0]])

  return result

The idea is that of a result type [A -> B...].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant