Browse Source

make change so code be run more easily

master^2
Iraj 4 years ago
parent
commit
6095b466d9

BIN
MissingNodes_SrcCode2014/PrepareAttributes5.mlx View File


BIN
MissingNodes_SrcCode2014/RunExpSrv8s.mlx View File


+ 997
- 0
MissingNodes_SrcCode2014/_Log/log.txt
File diff suppressed because it is too large
View File


+ 8
- 26
README.md View File

@@ -1,30 +1,12 @@
The "src" folder is the source code of SAMI paper which has seen some minor changes
The "MissingNodes_SrcCode2014" folder is the source code of SAMI paper which has seen some minor changes
from the original received version.
The "codes" folder is the folder containing the following files:
1.adjlisttext_tonxgraph.py: gets an adj. list as input file and gives out the visualized
graph
2.mat_tonxgraph.py: gets a .mat file as input file and gives out the visualized graph
3.mae.py: computes mae of two graphs given their .mat adj matrix file

For using the source code you must pay attention to two files: "RunExpSrv8s" and
"MissingNodes_S8b". The first one is the function which sets up the files and
calls the main function i.e. "MissingNodes_S8b".
**Running the project**
For running the source code you must use a command like "RunExpSrv8s('0','0','1')" where first parameter shows start of iteration,
second parameter shows end of iteration and last param is an arbitrary number.

**Input**
You must place all input files in a folder named "in" in root directory of project.

For having your own dataset run on this code you should know the below variables:

*RUNEXPSRV_8S.m
1. num_missing_nodes_arr: number of randomly removed nodes on each iteration
2. ds_*: array of node numbers of your input arr
3. ds_str: dataset path as a string
4. root_dir
5. file_prefix: file name prefix of the input files

*MISSINGNODES_S8B
1. k: filename postfix for saving
2. clusters_out: true and predicted graph saved as .mat file
3. graphs_out: 4 graphs including {original, predicted, predicted permuted,
original permuted} as .mat file


*grid dataset is run on the src code as an example
**Calcuating MAE**
For calculating the MEA you must first run the project to get the output then run the python code named "calc_mae.py"

+ 17
- 0
calc_mae.py View File

@@ -0,0 +1,17 @@
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import scipy.io as sp
import os

path = 'output\mine'
missing_node_count = 2
mae_list = list()
for filename in os.listdir(path):
adj_matrix_orig = sp.loadmat(path + '\\' + filename)['remapped_data'].A
adj_matrix_p = sp.loadmat(path + '\\' + filename)['out_data'].A
mae = np.sum(abs(adj_matrix_orig - adj_matrix_p))
mae = mae / (adj_matrix_p.shape[0] * 2 * missing_node_count)
mae_list.append(mae)

print(np.mean(mae_list))

BIN
output/OUTp_0.mat View File


BIN
output/OUTp_1.mat View File


BIN
output/OUTp_2.mat View File


BIN
output/OUTp_3.mat View File


BIN
output/OUTp_4.mat View File


BIN
output/OUTp_5.mat View File


BIN
output/graphed_0.mat View File


BIN
output/graphed_1.mat View File


BIN
output/graphed_2.mat View File


BIN
output/graphed_3.mat View File


BIN
output/graphed_4.mat View File


BIN
output/graphed_5.mat View File


Loading…
Cancel
Save