Coder Social home page Coder Social logo

adaptive-structural-fingerprint's People

Contributors

avigdorz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

adaptive-structural-fingerprint's Issues

calculation of structural interaction

i think the function structural_interaction in code utils_nhop_neighbors.py should be modified like this..

    for i, is_neighbor in enumerate(ri_index):
        for j, js_neighbor in enumerate(ri_index):
            intersection = list(set(is_neighbor).intersection(set(js_neighbor)))
            union = list(set(is_neighbor).union(set(js_neighbor)))
            union_rest = list(set(union).difference(set(intersection)))
    
            intersection_ri_all_i, intersection_ri_all_j = [], []
            union_ri_all_i, union_ri_all_j = [], []
            adj_delta[i][j] = 0
            if len(intersection) == 0:
                adj_delta[i][j] = 0.0001
                break
            **elif len(union_rest) == 0: # correct : intersection == union case simliarytiy maximum
                adj_delta[i][j] = 1.0
                break**
            else:
                for inter_neighbor in intersection:
                    intersection_ri_all_i.append(ri_all[i][is_neighbor.tolist().index(inter_neighbor)])
                    intersection_ri_all_j.append(ri_all[j][js_neighbor.tolist().index(inter_neighbor)])
    
                for rest_neighbor in union_rest:
                    if rest_neighbor in is_neighbor:
                        union_ri_all_i.append(ri_all[i][is_neighbor.tolist().index(rest_neighbor)])
                        union_ri_all_j.append(0)
                    else:
                        union_ri_all_j.append(ri_all[j][js_neighbor.tolist().index(rest_neighbor)])
                        union_ri_all_i.append(0)
    
                k_max = max(intersection_ri_all_j, intersection_ri_all_i)
                k_min = min(intersection_ri_all_j, intersection_ri_all_i)
                **final_max = k_max + union_ri_all_j + union_ri_all_i # correct** 
    
                union_num = np.sum(np.array(final_max), axis=0)
                inter_num = np.sum(np.array(k_min), axis=0)
    
                adj_delta[i][j] = inter_num/union_num

I corrected two parts, first, in case len(union_rest)==0, two nodes' (i and j) intersection set and union set are perfectly same, then these two nodes should have the highest intercation score?
and, second, when we calculate the denominator of jacard similarity, max term should also consider union_ri_all_i,?
is it rigiht? if not, plese give explain in more detail..

Problems in the source code

In the code block below from utils_nhop_neighbours.py โ†’ load_data

# calculate n-hop neighbors
    G = nx.DiGraph()
    # inf = pickle.load(open('adj_citeseer.pkl', 'rb'))
    inf = pickle.load(open("data/citeseer/ind.citeseer.graph", "rb"), encoding="latin1")
    for i in range(len(inf)):
        for j in range(len(inf[i])):
            G.add_edge(i, inf[i][j], weight=1)
    for i in range(3312):
          for j in range(3312):
              try:
                  rs = nx.astar_path_length \
                          (
                          G,
                          i,
                          j,
                      )
              except nx.NetworkXNoPath:
                 rs = 0
              if rs == 0:
                  length = 0
              else:
                  # print(rs)
                  length = len(rs)
              adj_delta[i][j] = length

Problem 1 len(G) is 3327 but in for loop to calculate shortest paths iterates in 3312 x 3312 range

Problem 2 nx.astar_path_length method returns the length of the shortest path between i and j but rs = nx.astar_path_length(G, i, j) value is used with length, length = len(rs), as if it is the shortest path, which raises error

TypeError: object of type 'int' has no len()

Problem 3 The following files are missing:
ri_index_c_0.5_citeseer_highorder_1_x_abs.pkl
ri_all_c_0.5_citeseer_highorder_1_x_abs.pkl

Could you please upload the correct version of the source code with much more explanation? Thanks.

calculation of RWR process

why did you utilize the unormalized transition probability matrix?
In rwr_process.py, matrix W (estimated to be transition probability matrix) is generated by just adding 0 and 1 iteratively.
why did you so?
In fact, in addition to this unormalized issue, i am confused as to why transition matrix is generted like the overall process of your code.
please explain in more detail.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.