Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/pyspark/mllib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
# MLlib currently needs NumPy 1.4+, so complain if lower

import numpy
if numpy.version.version < '1.4':
ver = numpy.version.version

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this before the official 1.10 release comes out! The following may be simpler:

ver = [int(x) for x in numpy.version.version.split(.)[:2]]
if ver < [1, 4]:
  raise ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this way of list comparison common? Funny, I haven't used it before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


fd = ver.find('.')
ver1 = int(ver[: fd])
ver = ver[fd + 1:]
ver2 = int(ver[: ver.find('.')])

if ver1 < 1 or (ver1 == 1 and ver2 <= 4):
raise Exception("MLlib requires NumPy 1.4+")

__all__ = ['classification', 'clustering', 'feature', 'fpm', 'linalg', 'random',
Expand Down