Giter Site home page Giter Site logo

mims-harvard / ohmnet Goto Github PK

View Code? Open in Web Editor NEW
78.0 7.0 33.0 504 KB

OhmNet: Representation learning in multi-layer graphs

Home Page: http://snap.stanford.edu/ohmnet

License: MIT License

Python 99.85% C 0.15%
multi-layer neural-embeddings bioinformatics genomics feature-learning deep-learning

ohmnet's Introduction

OhmNet

The OhmNet algorithm learns feature representations for nodes in any (un)directed, (un)weighted multi-layer network. Please check the project page for more details.

Usage

To run OhmNet on human brain multi-layer network with nine layers, run the following command from the project home directory:

python2.7 main.py --input "data/brain.list" --outdir "tmp" --hierarchy "data/brain.hierarchy" 

Options

To check OhmNet's running options, use:

python2.7 main.py --help

Output

Results are saved to output directory specified by the out_dir option.

The output file leaf_vectors.emb contains feature representations for nodes at the level of leaves in the hierarchy (i.e., leaves in the hierarchy correspond exactly to network layers).

The first line has the following format:

total_num_of_nodes_in_layers dim_of_representation

The next total_num_of_nodes_in_layers lines are as follows:

node_id dim1 dim2 ... dimd

where node_id is formatted as network_layer_name__node_id, and dim1, ... , dimd is the d-dimensional representation learned by OhmNet.

The output file internal_vectors.emb contains feature representations for nodes at higher levels in the hierarchy (i.e., internal levels in the hierarchy contain feature representations at intermediate/higher scales).

The first line has the following format:

total_num_of_nodes_in_hierarchy dim_of_representation

where total_num_of_nodes_in_hierarchy is equal to (size_hierarchy - num_layers) * total_num_nodes.

The next total_num_of_nodes_in_hierarchy lines are as follows:

node_id dim1 dim2 ... dimd

where node_id is formatted as hierarchy_element_name__node_id, and dim1, ... , dimd is the d-dimensional representation learned by OhmNet.

Citing

If you find OhmNet useful for your research, please consider citing the following paper presented at ISMB/ECCB 2017:

@article{Zitnik2017,
  title     = {Predicting multicellular function through multi-layer tissue networks},
  author    = {Zitnik, Marinka and Leskovec, Jure},
  journal   = {Bioinformatics},
  volume    = {33},
  number    = {14},
  pages     = {190-198},
  year      = {2017},
  publisher = {Oxford Journals}
}

Miscellaneous

Please send any questions you might have about the code and/or the algorithm to [email protected].

Note: This is a full Python implementation of OhmNet algorithm. A C++ implementation will be released as part of SNAP software.

Dependencies

OhmNet is tested to work under Python 2.7.

The required dependencies for OhmNet are NumPy >= 1.12, and NetworkX >= 1.11.

License

OhmNet is licensed under the MIT License.

ohmnet's People

Contributors

marinkaz 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ohmnet's Issues

Regularisation strength

In the paper it says the regularisation strength is a user specified parameter, but it is non of the command line inputs. Looking though the code it is not clear to me where to set this parameter.
Could you please advise me how to change this parameter.

Hierarchy error in full tissue network

I am attempting to run ohmnet on the full tissue ppi network from http://snap.stanford.edu/ohmnet/. There appears to be an error with the provided hierarchy file. The following error is produced.

Traceback (most recent call last):
  File "main.py", line 66, in <module>
    main(args)
  File "main.py", line 62, in main
    on.embed_multilayer()
  File "/local/david/ohmnet/ohmnet/ohmnet.py", line 212, in embed_multilayer
    all_nodes, leaf_vectors, internal_vectors)
  File "/local/david/ohmnet/ohmnet/ohmnet.py", line 91, in update_internal_vectors
    assert len(parents) == 1, 'Problem'
AssertionError: Problem

I am running ohmnet as follows python2.7 main.py --input data/tissues.list --outdir . --hierarchy bio-tissue-hierarchy/tissue.hierarchy

When run on the example brain network provided the code executes properly. I can see that the brain hierarchy seems to follow a different format than the provided tissue hierarchy. Do you have a working tissue hierarchy file or can you guide me on how to construct one?

Thanks!

Weighted graph mistakes

Dear professiors Marinka Zitnik and Jure Leskovec
I get wrong messages when I want to run Weighted graph.The messages is "TypeError: read_edgelist() got an unexpected keyword argument 'inodetype' โ€œ. and I explored the source code. I find there is a mistake in read_net function which in utility.py file
The source code is " if weighted: G = nx.read_edgelist(inodetype=int, data=(('weight', float),), create_using=nx.DiGraph()) " .It may be fixed as if weighted: G = nx.read_edgelist(fname, nodetype=int, data=(('weight', float),), create_using=nx.DiGraph())
sincerely
He

AttributeError: 'module' object has no attribute 'to_unicode'

When I run this code, the following error occurs. Could you please help me to figure out what's wrong?

INFO:ohmnet.gensimmod.model.word2vec:loading projection weights from emb/tmp.emb
Traceback (most recent call last):
File "main.py", line 66, in
main(args)
File "main.py", line 62, in main
on.embed_multilayer()
File "/Work/deeplearning/network-analysis/ohmnet/ohmnet/ohmnet.py", line 200, in embed_multilayer
self.model.load_parent_word2vec_format(fname=tmp_fname)
File "/Work/deeplearning/network-analysis/ohmnet/ohmnet/gensimmod/model/word2vec.py", line 1235, in load_parent_word2vec_format
header = utils.to_unicode(fin.readline(), encoding=encoding)
AttributeError: 'module' object has no attribute 'to_unicode'

AttributeError: 'module' object has no attribute 'qsize'

Hello @marinkaz
Thank you for sharing the code.
I am trying to run it on the given data of brain tissue-specific protein interaction network.
I got following error when I executed python2.7 main.py --input "data/brain.list" --outdir "tmp" --hierarchy "data/brain.hierarchy"

INFO:ohmnet.gensimmod.model.word2vec:training model with 8 workers on 16897 vocabulary and 128 features, using sg=1 hs=0 sample=0.001 negative=5 window=10

INFO:ohmnet.gensimmod.model.word2vec:expecting 84485 sentences, matching count from corpus used for vocabulary survey
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Processing: 0/100
Traceback (most recent call last):
File "main.py", line 66, in <module>
main(args)
File "main.py", line 62, in main
on.embed_multilayer()
File "ohmnet/ohmnet/ohmnet.py", line 197, in embed_multilayer
workers=self.n_workers, iter=1, batch_words=pushed_examples)
File "ohmnet/ohmnet/gensimmod/model/word2vec.py", line 416, in __init__
self.train(sentences)
File "ohmnet/ohmnet/gensimmod/model/word2vec.py", line 853, in train
utils.qsize(job_queue), utils.qsize(progress_queue))
AttributeError: 'module' object has no attribute 'qsize'

Could you please help in resolving this error?

Thanks,
Supriya

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.