Skip to content

Commit

Permalink
[SPARK-4821] [mllib] [python] [docs] Fix for pyspark.mllib.rand doc
Browse files Browse the repository at this point in the history
+ small doc edit
+ include edit to make IntelliJ happy

CC: davies  mengxr

Note to davies  -- this does not fix the "WARNING: Literal block expected; none found." warnings since that seems to involve spacing which IntelliJ does not like.  (Those warnings occur when generating the Python docs.)

Author: Joseph K. Bradley <[email protected]>

Closes #3669 from jkbradley/python-warnings and squashes the following commits:

4587868 [Joseph K. Bradley] fixed warning
8cb073c [Joseph K. Bradley] Updated based on davies recommendation
c51eca4 [Joseph K. Bradley] Updated rst file for pyspark.mllib.rand doc.  Small doc edit.  Small include edit to make IntelliJ happy.
  • Loading branch information
jkbradley authored and mengxr committed Dec 17, 2014
1 parent 636d9fc commit affc3f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
2 changes: 1 addition & 1 deletion python/docs/pyspark.streaming.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pyspark.streaming module
==================
========================

Module contents
---------------
Expand Down
27 changes: 1 addition & 26 deletions python/pyspark/mllib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,4 @@
import rand as random
random.__name__ = 'random'
random.RandomRDDs.__module__ = __name__ + '.random'


class RandomModuleHook(object):
"""
Hook to import pyspark.mllib.random
"""
fullname = __name__ + '.random'

def find_module(self, name, path=None):
# skip all other modules
if not name.startswith(self.fullname):
return
return self

def load_module(self, name):
if name == self.fullname:
return random

cname = name.rsplit('.', 1)[-1]
try:
return getattr(random, cname)
except AttributeError:
raise ImportError


sys.meta_path.append(RandomModuleHook())
sys.modules[__name__ + '.random'] = random
6 changes: 3 additions & 3 deletions python/pyspark/mllib/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class Normalizer(VectorTransformer):
"""
:: Experimental ::
Normalizes samples individually to unit L\ :sup:`p`\ norm
Normalizes samples individually to unit L\ :sup:`p`\ norm
For any 1 <= `p` <= float('inf'), normalizes samples using
sum(abs(vector). :sup:`p`) :sup:`(1/p)` as norm.
For any 1 <= `p` < float('inf'), normalizes samples using
sum(abs(vector) :sup:`p`) :sup:`(1/p)` as norm.
For `p` = float('inf'), max(abs(vector)) will be used as norm for normalization.
Expand Down

0 comments on commit affc3f4

Please sign in to comment.