GithubHelp home page GithubHelp logo

Comments (9)

panda0881 avatar panda0881 commented on June 10, 2024

That is because you are using a different version of networkx. But you should be able to solve the problem easily by following this link:
pgmpy/pgmpy#927

Hongming

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

great thanks for soon answer
sorry but this not helping, my guess they use iterators in version, so code crushes when cur_nbrs become empty
there is an error now

File "e:\graphs ML\code\MNE_28May_removed_LINE_NX_bugfix\MNE-master\MNE_May28_changed_main.py", line 537, in <module>
  performance_1, performance_2, performance_3 = Evaluate_PMNE_methods(merged_networks)
File "e:\graphs ML\code\MNE_28May_removed_LINE_NX_bugfix\MNE-master\MNE_May28_changed_main.py", line 412, in Evaluate_PMNE_methods
  MK_walks = MK_G.simulate_walks(args.num_walks, args.walk_length)
File "e:\graphs ML\code\MNE_28May_removed_LINE_NX_bugfix\MNE-master\Node2Vec_LayerSelect.py", line 78, in simulate_walks
  walks.append(self.node2vec_walk(walk_length=walk_length, start_node=node, G=G))
File "e:\graphs ML\code\MNE_28May_removed_LINE_NX_bugfix\MNE-master\Node2Vec_LayerSelect.py", line 50, in node2vec_walk
  walk.append(cur_nbrs[alias_draw(alias_nodes_list[G][cur][0], alias_nodes_list[G][cur][1])])

builtins.TypeError: 'dict_keyiterator' object is not subscriptable

variables involved have this values



alias_nodes_list[G][cur][0]
array([0, 0, 0, 0])
alias_nodes_list[G][cur][1]
array([1., 1., 1., 1.])
list(cur_nbrs) 
[]
len(  list(cur_nbrs)  ) > 0
False
len(walk)
1
cur_nbrs
<dict_keyiterator object at 0x0000027B34021318>

hopefully, you will be able to fix the code
thanks

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

ok I changed code in Node2Vec_LayerSelect.py
like this

            #if len(cur_nbrs) > 0:  # original
            if len(  list(cur_nbrs)  ) > 0:  # May28
                # if len(walk) == 1: # original
                if (len(walk) == 1):
                    if len(  list(cur_nbrs)  ) ==0 : # May28
                        break
                    walk.append(cur_nbrs[alias_draw(alias_nodes_list[G][cur][0], alias_nodes_list[G][cur][1])])
                else:
                    if len(  list(cur_nbrs)  ) == 0 : # May28
                        break                    
                    prev = walk[-2]
                    if (prev, cur) not in alias_edges_list[G].keys():
                        prev = cur_nbrs[alias_draw(alias_nodes_list[G][cur][0], alias_nodes_list[G][cur][1])]
                    next = cur_nbrs[
                        alias_draw(alias_edges_list[G][(prev, cur)][0], alias_edges_list[G][(prev, cur)][1])]
                    walk.append(next)
                    # print("ending graph", graphs.index(G))
            else:
                break

        return walk

now it runs till end
results are

Performance of PMNE method three: 0.5070752895752896
Overall MRNE AUC: [0.85530911 0.89128434 0.85494857 0.88142803 0.87209294]
Overall node2Vec AUC: [0.79673615 0.78516926 0.79151336 0.79038582 0.80425014]
Overall Deepwalk AUC: [0.79673615 0.78516926 0.79151336 0.79038582 0.80425014]
Overall Common neighbor AUC: [0.79341216 0.77095724 0.81174762 0.79144072 0.82143098]
Overall Jaccard AUC: [0.78594836 0.7573275  0.77645476 0.76385326 0.80092905]
Overall AA AUC: [0.79861245 0.77773324 0.81499524 0.79813168 0.82742278]
Overall PMNE 1 AUC: [0.8383639  0.80039359 0.81269524 0.79948008 0.82573359]
Overall PMNE 2 AUC: [0.82370174 0.85150146 0.8312381  0.84353256 0.86548263]
Overall PMNE 3 AUC: [0.50269788 0.51138484 0.5002     0.5231827  0.50707529]



Overall MRNE AUC: 0.87101259684976
Overall node2Vec AUC: 0.7936109460183672
Overall Deepwalk AUC: 0.7936109460183672
Overall Common neighbor AUC: 0.7977977449898879
Overall Jaccard AUC: 0.7769025866099335
Overall AA AUC: 0.8033790774301999
Overall PMNE 1 AUC: 0.8153332784387887
Overall PMNE 2 AUC: 0.84309129435558
Overall PMNE 3 AUC: 0.5089081414650802



Overall MRNE std: 0.014319526236232036
Overall node2Vec std: 0.0064656437019227605
Overall Deepwalk std: 0.0064656437019227605
Overall Common neighbor std: 0.017511064039483683
Overall Jaccard std: 0.015574123699654446
Overall AA std: 0.016858231700063453
Overall PMNE 1 std: 0.014966987984306158
Overall PMNE 2 std: 0.01475635805702641
Overall PMNE 3 std: 0.008095129002580756
end

is it correct?

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

which one of results is for MNE as stated in a paper fro Vickers in Table 2

MNE 0.871 (0.014)

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

node2Vec and Deepwalk are identical even for std , in paper std is different

Overall node2Vec AUC: [0.79673615 0.78516926 0.79151336 0.79038582 0.80425014]
Overall Deepwalk AUC: [0.79673615 0.78516926 0.79151336 0.79038582 0.80425014]
Overall node2Vec AUC: 0.7936109460183672
Overall Deepwalk AUC: 0.7936109460183672
Overall node2Vec std: 0.0064656437019227605
Overall Deepwalk std: 0.0064656437019227605

from mne.

panda0881 avatar panda0881 commented on June 10, 2024

As we are conducting 5-fold cross-validation, the first group reports all of the performance, the second group reports the average, and the last group reports the std.

For the identical question, it is normal, because this sample network is very small (only 29 nodes). I checked and tested the code on my pc, the code is correct. If you try a larger network, that should be different.

By the way, I double-check the paper, the performance of Deepwalk and Node2vec are the same (including std) on small networks but different on the large network.

Hongming

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

I see thanks
is output
Overall MRNE AUC: 0.87101259684976
stands for performance from Table 2
MNE 0.871 (0.014)
??

from mne.

panda0881 avatar panda0881 commented on June 10, 2024

from mne.

Sandy4321 avatar Sandy4321 commented on June 10, 2024

great thanks for soon answer

from mne.

Related Issues (20)

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.