Coder Social home page Coder Social logo

benedekrozemberczki / splitter Goto Github PK

View Code? Open in Web Editor NEW
207.0 11.0 44.0 11.68 MB

A Pytorch implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019).

License: GNU General Public License v3.0

Python 100.00%
deepwalk pytorch node2vec gensim ego-splitting machine-learning word2vec factorization implicit-factorization deep-learning

splitter's People

Contributors

adasken avatar benedekrozemberczki 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  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  avatar  avatar  avatar  avatar

splitter's Issues

Abnormal results of embedding

When i run this model in different datasets (e.g blogcatalog), Some of the dimensions of the vector are greater than or less than negative 1, for example, (1.0,-7.087762355804443,-26.554523468017578,4.721840858459473, ...)

blogcatalog.zip

IndexError: index ... is out of bounds for axis 0 with size ...

I'm getting the same error.

Traceback (most recent call last):
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/main.py", line 24, in <module>
    main()
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/main.py", line 19, in main
    trainer.fit()
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/splitter.py", line 229, in fit
    self.setup_model()
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/splitter.py", line 159, in setup_model
    self.egonet_splitter.personality_map)
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/splitter.py", line 52, in initialize_weights
    persona_embedding = np.array([base_node_embedding[n] for _, n in mapping.items()])
  File "/home/shady/Projects/GML/SPLITTER/Splitter/src/splitter.py", line 52, in <listcomp>
    persona_embedding = np.array([base_node_embedding[n] for _, n in mapping.items()])
IndexError: index 8637 is out of bounds for axis 0 with size 8637

The dataset is sorted and also IDs start from zero with no index and header. Also, it just happens on the CA-HepTh dataset and not others which is strange.

AttributeError: module 'networkx' has no attribute 'selfloop_edges'

Hello, I followed the instruction to install all the required python packages but when I ran 'python3 src/main.py', I got the following error. Could you please let me know how I can fix it? Thank you!

Traceback (most recent call last):
File "src/main.py", line 24, in
main()
File "src/main.py", line 17, in main
graph = graph_reader(args.edge_path)
File "/Users/machunyu/KoslickiLab/Splitter/src/utils.py", line 26, in graph_reader
graph.remove_edges_from(nx.selfloop_edges(graph))
AttributeError: module 'networkx' has no attribute 'selfloop_edges'

an unexpected keyword argument 'iter' in walker?

Hello! I am new in this work ,but when I try to run the code , the error "an unexpected keyword argument 'iter" occured in the function def learn_base_embedding(self) in walkers.py. It seems that the parameter 'iter' in
model = Word2Vec(self.paths, size=self.args.dimensions, window=self.args.window_size, min_count=1, sg=1, workers=self.args.workers, iter=1) is wrong ?

an error in walker maybe?

I dont know much about this work in details. however, while implementing i am running into sample larger than population. I think in src/walker.py it should be

def small_walk(self, start_node):
        """
        Doing a truncated random walk.
        :param start_node: Start node for random walk.
        :return walk: Truncated random walk with fixed maximal length.
        """
        walk = [start_node]
        while len(walk) < self.args.walk_length:
            if len(nx.neighbors(self.graph,walk[-1])) ==0:
                break
            walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
        return walk

Instead of

def small_walk(self, start_node):
        """
        Doing a truncated random walk.
        :param start_node: Start node for random walk.
        :return walk: Truncated random walk with fixed maximal length.
        """
        walk = [start_node]
        while len(walk) < self.args.walk_length:
            walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
            if len(nx.neighbors(self.graph,walk[-1])) ==0:
                break
        return walk

Index Error

I'm getting this error while running your code:

File "C:\Users\ANJALI\environments\splitter\src\splitter.py", line 41, in <listcomp>
persona_embedding = np.array([base_node_embedding[original_node] for node, original_node in mapping.items()])
IndexError: index 599 is out of bounds for axis 0 with size 599

The number of nodes in my graph are 599. What is the cause for this error?

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.