Skip to content

Commit 4bccfee

Browse files
committed
fix doctest
1 parent ec09412 commit 4bccfee

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

python/pyspark/mllib/regression.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -402,26 +402,22 @@ class IsotonicRegressionModel(Saveable, Loader):
402402

403403
"""Regression model for isotonic regression.
404404
405-
>>> data = [(2, 1, 1), (1, 1, 1), (4, 2, 1), (2, 2, 1), (6, 3, 1), (5, 3, 1)]
405+
>>> data = [(1, 0, 1), (2, 1, 1), (3, 2, 1), (1, 3, 1), (6, 4, 1), (17, 5, 1), (16, 6, 1)]
406406
>>> irm = IsotonicRegression.train(sc.parallelize(data))
407-
>>> irm.predict(1.5)
407+
>>> irm.predict(3)
408408
2.0
409-
>>> irm.predict(2.5)
410-
4.5
411-
>>> irm.predict(4)
412-
6.0
413-
>>> irm.predict(sc.parallelize([1.5, 2.5, 4])).collect()
414-
[2.0, 4.5, 6.0]
409+
>>> irm.predict(5)
410+
16.5
411+
>>> irm.predict(sc.parallelize([3, 5])).collect()
412+
[2.0, 16.5]
415413
>>> import os, tempfile
416414
>>> path = tempfile.mkdtemp()
417415
>>> irm.save(sc, path)
418416
>>> sameModel = IsotonicRegressionModel.load(sc, path)
419-
>>> sameModel.predict(1.5)
417+
>>> sameModel.predict(3)
420418
2.0
421-
>>> sameModel.predict(2.5)
422-
4.5
423-
>>> sameModel.predict(4)
424-
6.0
419+
>>> sameModel.predict(5)
420+
16.5
425421
>>> try:
426422
... os.removedirs(path)
427423
... except OSError:

0 commit comments

Comments
 (0)