Skip to content

Commit

Permalink
Merge pull request #321 from vmarkovtsev/master
Browse files Browse the repository at this point in the history
Fix the --devs shape edge case
  • Loading branch information
vmarkovtsev committed Nov 6, 2019
2 parents a34cfd7 + 0a0292b commit 5263b0a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion python/labours/modes/devs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def show_devs(
prop_cycle = pyplot.rcParams["axes.prop_cycle"]
colors = prop_cycle.by_key()["color"]
fig, axes = pyplot.subplots(final.shape[0], 1)
try:
axes = tuple(axes)
except TypeError:
axes = axes,
backgrounds = (
("#C4FFDB", "#FFD0CD") if args.background == "white" else ("#05401C", "#40110E")
)
Expand Down Expand Up @@ -227,7 +231,10 @@ def hdbscan_cluster_routed_series(
[0] + [dists[route[i], route[i + 1]] for i in range(len(route) - 1)]
)
)
clusters = HDBSCAN(min_cluster_size=2).fit_predict(opt_dist_chain[:, numpy.newaxis])
if len(route) < 2:
clusters = numpy.zeros(len(route), dtype=int)
else:
clusters = HDBSCAN(min_cluster_size=2).fit_predict(opt_dist_chain[:, numpy.newaxis])
return clusters


Expand Down
2 changes: 1 addition & 1 deletion python/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ scipy>=0.19.0,<1.2.2
protobuf>=3.5.0,<4.0
munch>=2.0,<3.0
hdbscan>=0.8.0,<2.0
seriate>=1.0,<2.0
seriate>=1.1.2,<2.0
fastdtw>=0.3.2,<2.0
python-dateutil>=2.6.0,<3.0
lifelines>=0.20.0,<2.0
Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pytz==2019.2 # via pandas
pyyaml==3.13
scikit-learn==0.21.3 # via hdbscan
scipy==1.2.1
seriate==1.1.0
seriate==1.1.2
six==1.12.0 # via cycler, munch, ortools, packaging, protobuf, python-dateutil
tqdm==4.36.1

Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
description="Python companion for github.com/src-d/hercules to visualize the results.",
long_description=long_description,
long_description_content_type="text/markdown",
version="10.5.1",
version="10.5.2",
license="Apache-2.0",
author="source{d}",
author_email="machine-learning@sourced.tech",
Expand Down

0 comments on commit 5263b0a

Please sign in to comment.