Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removal of vestigial gensim import #127

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deepwalk/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def process(args):
walks = graph.build_deepwalk_corpus(G, num_paths=args.number_walks,
path_length=args.walk_length, alpha=0, rand=random.Random(args.seed))
print("Training...")
model = Word2Vec(walks, size=args.representation_size, window=args.window_size, min_count=0, sg=1, hs=1, workers=args.workers)
model = Word2Vec(walks, vector_size=args.representation_size, window=args.window_size, min_count=0, sg=1, hs=1, workers=args.workers)
else:
print("Data size {} is larger than limit (max-memory-data-size: {}). Dumping walks to disk.".format(data_size, args.max_memory_data_size))
print("Walking...")
Expand Down
7 changes: 3 additions & 4 deletions deepwalk/skipgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import logging
from multiprocessing import cpu_count
from six import string_types

from gensim.models import Word2Vec
from gensim.models.word2vec import Vocab

logger = logging.getLogger("deepwalk")


class Skipgram(Word2Vec):
"""A subclass to allow more customization of the Word2Vec internals."""

Expand All @@ -24,7 +23,7 @@ def __init__(self, vocabulary_counts=None, **kwargs):
kwargs["sg"] = 1
kwargs["hs"] = 1

if vocabulary_counts != None:
self.vocabulary_counts = vocabulary_counts
if vocabulary_counts is not None:
self.vocabulary_counts = vocabulary_counts

super(Skipgram, self).__init__(**kwargs)