spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbradley <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-3961] [MLlib] [PySpark] Python API for ...
Date Mon, 27 Oct 2014 19:15:45 GMT
Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2819#discussion_r19429959
  
    --- Diff: docs/mllib-feature-extraction.md ---
    @@ -267,4 +346,25 @@ val data1 = data.map(x => (x.label, normalizer1.transform(x.features)))
     val data2 = data.map(x => (x.label, normalizer2.transform(x.features)))
     {% endhighlight %}
     </div>
    +
    +<div data-lang="python">
    +{% highlight python %}
    +from pyspark.mllib.util import MLUtils
    +from pyspark.mllib.linalg import Vectors
    +from pyspark.mllib.feature import Normalizer
    +
    +data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
    +label = data.map(lambda x: x.label)
    +features = data.map(lambda x: x.features)
    +
    +normalizer1 = Normalizer()
    +normalizer2 = Normalizer(p=float("inf"))
    +
    +# Each sample in data1 will be normalized using $L^2$ norm.
    +data1 = label.zip(normalizer1.transform(features))
    +
    +# Each sample in data2 will be normalized using $L^\infty$ norm.
    +data2 = label.zip(normalizer2.transform(features))
    --- End diff --
    
    This line fails because the p = infinity is not handled correctly somewhere.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message