Skip to content

Commit 98b212d

Browse files
yinxusenjkbradley
authored andcommittedDec 13, 2015
[SPARK-12199][DOC] Follow-up: Refine example code in ml-features.md
https://issues.apache.org/jira/browse/SPARK-12199 Follow-up PR of SPARK-11551. Fix some errors in ml-features.md mengxr Author: Xusen Yin <[email protected]> Closes apache#10193 from yinxusen/SPARK-12199.
1 parent 03138b6 commit 98b212d

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed
 

‎docs/ml-features.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ the [IDF Python docs](api/python/pyspark.ml.html#pyspark.ml.feature.IDF) for mor
6363
`Word2VecModel`. The model maps each word to a unique fixed-size vector. The `Word2VecModel`
6464
transforms each document into a vector using the average of all words in the document; this vector
6565
can then be used for as features for prediction, document similarity calculations, etc.
66-
Please refer to the [MLlib user guide on Word2Vec](mllib-feature-extraction.html#Word2Vec) for more
66+
Please refer to the [MLlib user guide on Word2Vec](mllib-feature-extraction.html#word2Vec) for more
6767
details.
6868

6969
In the following code segment, we start with a set of documents, each of which is represented as a sequence of words. For each document, we transform it into a feature vector. This feature vector could then be passed to a learning algorithm.
@@ -411,7 +411,7 @@ for more details on the API.
411411
Refer to the [DCT Java docs](api/java/org/apache/spark/ml/feature/DCT.html)
412412
for more details on the API.
413413

414-
{% include_example java/org/apache/spark/examples/ml/JavaDCTExample.java %}}
414+
{% include_example java/org/apache/spark/examples/ml/JavaDCTExample.java %}
415415
</div>
416416
</div>
417417

@@ -669,23 +669,23 @@ for more details on the API.
669669
The following example demonstrates how to load a dataset in libsvm format and then normalize each row to have unit $L^2$ norm and unit $L^\infty$ norm.
670670

671671
<div class="codetabs">
672-
<div data-lang="scala">
672+
<div data-lang="scala" markdown="1">
673673

674674
Refer to the [Normalizer Scala docs](api/scala/index.html#org.apache.spark.ml.feature.Normalizer)
675675
for more details on the API.
676676

677677
{% include_example scala/org/apache/spark/examples/ml/NormalizerExample.scala %}
678678
</div>
679679

680-
<div data-lang="java">
680+
<div data-lang="java" markdown="1">
681681

682682
Refer to the [Normalizer Java docs](api/java/org/apache/spark/ml/feature/Normalizer.html)
683683
for more details on the API.
684684

685685
{% include_example java/org/apache/spark/examples/ml/JavaNormalizerExample.java %}
686686
</div>
687687

688-
<div data-lang="python">
688+
<div data-lang="python" markdown="1">
689689

690690
Refer to the [Normalizer Python docs](api/python/pyspark.ml.html#pyspark.ml.feature.Normalizer)
691691
for more details on the API.
@@ -709,23 +709,23 @@ Note that if the standard deviation of a feature is zero, it will return default
709709
The following example demonstrates how to load a dataset in libsvm format and then normalize each feature to have unit standard deviation.
710710

711711
<div class="codetabs">
712-
<div data-lang="scala">
712+
<div data-lang="scala" markdown="1">
713713

714714
Refer to the [StandardScaler Scala docs](api/scala/index.html#org.apache.spark.ml.feature.StandardScaler)
715715
for more details on the API.
716716

717717
{% include_example scala/org/apache/spark/examples/ml/StandardScalerExample.scala %}
718718
</div>
719719

720-
<div data-lang="java">
720+
<div data-lang="java" markdown="1">
721721

722722
Refer to the [StandardScaler Java docs](api/java/org/apache/spark/ml/feature/StandardScaler.html)
723723
for more details on the API.
724724

725725
{% include_example java/org/apache/spark/examples/ml/JavaStandardScalerExample.java %}
726726
</div>
727727

728-
<div data-lang="python">
728+
<div data-lang="python" markdown="1">
729729

730730
Refer to the [StandardScaler Python docs](api/python/pyspark.ml.html#pyspark.ml.feature.StandardScaler)
731731
for more details on the API.
@@ -788,23 +788,23 @@ More details can be found in the API docs for [Bucketizer](api/scala/index.html#
788788
The following example demonstrates how to bucketize a column of `Double`s into another index-wised column.
789789

790790
<div class="codetabs">
791-
<div data-lang="scala">
791+
<div data-lang="scala" markdown="1">
792792

793793
Refer to the [Bucketizer Scala docs](api/scala/index.html#org.apache.spark.ml.feature.Bucketizer)
794794
for more details on the API.
795795

796796
{% include_example scala/org/apache/spark/examples/ml/BucketizerExample.scala %}
797797
</div>
798798

799-
<div data-lang="java">
799+
<div data-lang="java" markdown="1">
800800

801801
Refer to the [Bucketizer Java docs](api/java/org/apache/spark/ml/feature/Bucketizer.html)
802802
for more details on the API.
803803

804804
{% include_example java/org/apache/spark/examples/ml/JavaBucketizerExample.java %}
805805
</div>
806806

807-
<div data-lang="python">
807+
<div data-lang="python" markdown="1">
808808

809809
Refer to the [Bucketizer Python docs](api/python/pyspark.ml.html#pyspark.ml.feature.Bucketizer)
810810
for more details on the API.

‎examples/src/main/java/org/apache/spark/examples/ml/JavaBinarizerExample.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void main(String[] args) {
5959
DataFrame binarizedDataFrame = binarizer.transform(continuousDataFrame);
6060
DataFrame binarizedFeatures = binarizedDataFrame.select("binarized_feature");
6161
for (Row r : binarizedFeatures.collect()) {
62-
Double binarized_value = r.getDouble(0);
62+
Double binarized_value = r.getDouble(0);
6363
System.out.println(binarized_value);
6464
}
6565
// $example off$

‎examples/src/main/python/ml/polynomial_expansion_example.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
# $example on$
3232
df = sqlContext\
33-
.createDataFrame([(Vectors.dense([-2.0, 2.3]), ),
34-
(Vectors.dense([0.0, 0.0]), ),
35-
(Vectors.dense([0.6, -1.1]), )],
33+
.createDataFrame([(Vectors.dense([-2.0, 2.3]),),
34+
(Vectors.dense([0.0, 0.0]),),
35+
(Vectors.dense([0.6, -1.1]),)],
3636
["features"])
3737
px = PolynomialExpansion(degree=2, inputCol="features", outputCol="polyFeatures")
3838
polyDF = px.transform(df)

0 commit comments

Comments
 (0)