Skip to content

Commit 5263b0a

Browse files
authored
Merge pull request #321 from vmarkovtsev/master
Fix the --devs shape edge case
2 parents a34cfd7 + 0a0292b commit 5263b0a

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

python/labours/modes/devs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def show_devs(
6464
prop_cycle = pyplot.rcParams["axes.prop_cycle"]
6565
colors = prop_cycle.by_key()["color"]
6666
fig, axes = pyplot.subplots(final.shape[0], 1)
67+
try:
68+
axes = tuple(axes)
69+
except TypeError:
70+
axes = axes,
6771
backgrounds = (
6872
("#C4FFDB", "#FFD0CD") if args.background == "white" else ("#05401C", "#40110E")
6973
)
@@ -227,7 +231,10 @@ def hdbscan_cluster_routed_series(
227231
[0] + [dists[route[i], route[i + 1]] for i in range(len(route) - 1)]
228232
)
229233
)
230-
clusters = HDBSCAN(min_cluster_size=2).fit_predict(opt_dist_chain[:, numpy.newaxis])
234+
if len(route) < 2:
235+
clusters = numpy.zeros(len(route), dtype=int)
236+
else:
237+
clusters = HDBSCAN(min_cluster_size=2).fit_predict(opt_dist_chain[:, numpy.newaxis])
231238
return clusters
232239

233240

python/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ scipy>=0.19.0,<1.2.2
66
protobuf>=3.5.0,<4.0
77
munch>=2.0,<3.0
88
hdbscan>=0.8.0,<2.0
9-
seriate>=1.0,<2.0
9+
seriate>=1.1.2,<2.0
1010
fastdtw>=0.3.2,<2.0
1111
python-dateutil>=2.6.0,<3.0
1212
lifelines>=0.20.0,<2.0

python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pytz==2019.2 # via pandas
2727
pyyaml==3.13
2828
scikit-learn==0.21.3 # via hdbscan
2929
scipy==1.2.1
30-
seriate==1.1.0
30+
seriate==1.1.2
3131
six==1.12.0 # via cycler, munch, ortools, packaging, protobuf, python-dateutil
3232
tqdm==4.36.1
3333

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
description="Python companion for github.com/src-d/hercules to visualize the results.",
2323
long_description=long_description,
2424
long_description_content_type="text/markdown",
25-
version="10.5.1",
25+
version="10.5.2",
2626
license="Apache-2.0",
2727
author="source{d}",
2828
author_email="machine-learning@sourced.tech",

0 commit comments

Comments
 (0)