Skip to content

Commit

Permalink
Fix the failures of test suites in pyspark by round the result
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw committed May 21, 2015
1 parent 957d3e2 commit ba5c208
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/pyspark/mllib/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ class HierarchicalClusteringModel(JavaModelWrapper, JavaSaveable, JavaLoader):
<type 'numpy.ndarray'>
>>> abs(model.WSSSE(sparse_rdd) - 0.2) < 10e-2
True
>>> model.toLinkageMatrix()
[[0.0, 1.0, 0.74246212024587488, 2.0]]
>>> model.toAdjacencyList()
[[0.0, 1.0, 0.74246212024587488], [0.0, 2.0, 0.74246212024587488]]
>>> linkage_list = model.toLinkageMatrix()
>>> [map(lambda y: round(y, 8), x) for x in linkage_list]
[[0.0, 1.0, 0.74246212, 2.0]]
>>> adjacency_list = model.toAdjacencyList()
>>> [map(lambda y: round(y, 8), x) for x in adjacency_list]
[[0.0, 1.0, 0.74246212], [0.0, 2.0, 0.74246212]]
>>> import os, tempfile
>>> path = os.path.join(tempfile.gettempdir(), str(id(model)))
Expand Down

0 comments on commit ba5c208

Please sign in to comment.