Skip to content

Commit

Permalink
Added numba to setup.py requirements (under demos) and requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
adocherty committed Sep 4, 2018
1 parent 8eabe48 commit 5ca6c0f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 42 deletions.
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[tool.poetry]
name = "stellargraph"
version = "0.4.0"
description = "Python library for machine learning on graphs"
repository = "https://github.com/stellargraph/stellargraph"
authors = ["Data61, CSIRO"]
license = "Apache-2.0"
readme = "README.md"

[tool.poetry.dependencies]
python = "3.6"
Keras = "^2.1"
tensorflow = "^1.8"
numpy = "^1.14"
networkx = "^2.1"
scikit-learn = "^0.18"
gensim = "^3.4"
matplotlib = "^2.2"
pandas = "^0.20"
numba = "^0.39"

[tool.poetry.dev-dependencies]
pytest = "^3.7"
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ networkx==2.1
setuptools==39.1.0
Keras==2.2.2
tensorflow==1.10.0
numba==0.39.0
numpy==1.14.5
progressbar2==3.37.1
scikit_learn==0.19.2
Expand Down
19 changes: 9 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@

# Required packages
REQUIRES = [
"keras",
"tensorflow",
"numpy",
"networkx",
"progressbar2",
"scikit_learn",
"matplotlib",
"gensim",
"keras>=2.2.0",
"tensorflow>=1.8",
"numpy>=1.14, <1.15",
"networkx>=2.1",
"scikit_learn>=0.18",
"matplotlib>=2.2",
"gensim>=3.4.0",
]


EXTRAS_REQURES = {"demos": ["pandas"], "tests": ["pytest", "pytest-pep8", "pandas"]}
EXTRAS_REQURES = {"demos": ["pandas", "numba"], "test": ["pytest", "pandas"]}

# Long description
with open("README.md", "r") as fh:
Expand All @@ -49,6 +47,7 @@
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
include_package_data=True,
python_requires='>=3.6.0, <3.7.0',
install_requires=REQUIRES,
extras_require=EXTRAS_REQURES,
packages=setuptools.find_packages(exclude=("tests",)),
Expand Down
43 changes: 11 additions & 32 deletions stellargraph/data/epgm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import multiprocessing
from multiprocessing import Pool
from functools import partial
from progressbar import ProgressBar, SimpleProgress
#from progressbar import ProgressBar, SimpleProgress
from time import sleep


Expand Down Expand Up @@ -359,14 +359,14 @@ def to_nx_OLD(
n = len(nodes)
self.G_nx[graph_id] = []

pbar = ProgressBar(
widgets=[
SimpleProgress(
format="%(value_s)s of %(max_value_s)s nodes processed (%(percentage)3d%%)"
)
],
maxval=n,
).start()
# pbar = ProgressBar(
# widgets=[
# SimpleProgress(
# format="%(value_s)s of %(max_value_s)s nodes processed (%(percentage)3d%%)"
# )
# ],
# maxval=n,
# ).start()
# _ = [pool.apply_async(partial(node_neighbours, edges=edges), args=(v,),
# callback=self.G_nx[graph_id].append) for v in nodes]
# it seems that appending results using callback works much slower than either pool.map_async or pool.map
Expand All @@ -380,9 +380,9 @@ def to_nx_OLD(
# evaluate batches of imap, as the progress bar is being updated:
while len(self.G_nx[graph_id]) != n:
self.G_nx[graph_id].append(next(graph))
pbar.update(len(self.G_nx[graph_id]))
# pbar.update(len(self.G_nx[graph_id]))

pbar.finish()
# pbar.finish()

self.G_nx[graph_id] = dict(self.G_nx[graph_id])

Expand All @@ -395,27 +395,6 @@ def to_nx_OLD(
pool.join()

else: # sequential execution
if progress:
n = len(nodes)
# graph = {self._progress('node', n, progress_step, i, v): [e[1] for e in edges if e[0] == v] for i, v in
# enumerate(nodes)} # this works ~2.5x faster (for cora dataset) than the above for loop
pbar = ProgressBar(
widgets=[
SimpleProgress(
format="%(value_s)s of %(max_value_s)s nodes processed"
)
],
maxval=n,
).start()
self.G_nx[graph_id] = {
self._progressbarUpdate(pbar, chunksize, v, i): [
e[1] for e in edges if e[0] == v
]
for i, v in enumerate(nodes)
} # this works ~2.5x faster (for cora dataset) than the above for loop
pbar.finish()

else:
self.G_nx[graph_id] = {
v: [e[1] for e in edges if e[0] == v] for v in nodes
} # this works ~2.5x faster (for cora dataset) than the above for loop
Expand Down

0 comments on commit 5ca6c0f

Please sign in to comment.