You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

calc_mae.py 516B

1234567891011121314151617
  1. import numpy as np
  2. import networkx as nx
  3. import matplotlib.pyplot as plt
  4. import scipy.io as sp
  5. import os
  6. path = 'output\mine'
  7. missing_node_count = 2
  8. mae_list = list()
  9. for filename in os.listdir(path):
  10. adj_matrix_orig = sp.loadmat(path + '\\' + filename)['remapped_data'].A
  11. adj_matrix_p = sp.loadmat(path + '\\' + filename)['out_data'].A
  12. mae = np.sum(abs(adj_matrix_orig - adj_matrix_p))
  13. mae = mae / (adj_matrix_p.shape[0] * 2 * missing_node_count)
  14. mae_list.append(mae)
  15. print(np.mean(mae_list))