Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-11551][DOC] Replace example code in ml-features.md using include_example #10219

Closed
wants to merge 16 commits into from

Conversation

yinxusen
Copy link
Contributor

@yinxusen yinxusen commented Dec 9, 2015

PR on behalf of @somideshmukh, thanks!

@yinxusen
Copy link
Contributor Author

yinxusen commented Dec 9, 2015

ok to test

@SparkQA
Copy link

SparkQA commented Dec 9, 2015

Test build #47413 has finished for PR 10219 at commit 8748a88.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * public class JavaBinarizerExample\n * public class JavaBucketizerExample\n * public class JavaDCTExample\n * public class JavaElementwiseProductExample\n * public class JavaMinMaxScalerExample\n * public class JavaNGramExample\n * public class JavaNormalizerExample\n * public class JavaOneHotEncoderExample\n * public class JavaPCAExample\n * public class JavaPolynomialExpansionExample\n * public class JavaRFormulaExample\n * public class JavaStandardScalerExample\n * public class JavaStopWordsRemoverExample\n * public class JavaStringIndexerExample\n * public class JavaTokenizerExample\n * public class JavaVectorAssemblerExample\n * public class JavaVectorIndexerExample\n * public class JavaVectorSlicerExample\n

@yinxusen
Copy link
Contributor Author

yinxusen commented Dec 9, 2015

Ping @mengxr, this is for SPARK-11551. Please sign it off if looks good to you.

}
}
// scalastyle:on println

Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing line

@BenFradet
Copy link
Contributor

I notice some formatting quirks, especially for scala examples, otherwise it looks good.

However, shouldn't we take advantage of this pr to standardize the output of the examples?
For example, I think every example should end with a show() or println so the user can just c/c the example and see what it does for himself.

@yinxusen
Copy link
Contributor Author

yinxusen commented Dec 9, 2015

@BenFradet It's reasonable. I'll modify them now. Thanks for the review.

@yinxusen
Copy link
Contributor Author

yinxusen commented Dec 9, 2015

@BenFradet Does the code look good for you?

@SparkQA
Copy link

SparkQA commented Dec 9, 2015

Test build #47427 has finished for PR 10219 at commit 771d015.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * public class JavaBinarizerExample\n * public class JavaBucketizerExample\n * public class JavaDCTExample\n * public class JavaElementwiseProductExample\n * public class JavaMinMaxScalerExample\n * public class JavaNGramExample\n * public class JavaNormalizerExample\n * public class JavaOneHotEncoderExample\n * public class JavaPCAExample\n * public class JavaPolynomialExpansionExample\n * public class JavaRFormulaExample\n * public class JavaStandardScalerExample\n * public class JavaStopWordsRemoverExample\n * public class JavaStringIndexerExample\n * public class JavaTokenizerExample\n * public class JavaVectorAssemblerExample\n * public class JavaVectorIndexerExample\n * public class JavaVectorSlicerExample\n

@BenFradet
Copy link
Contributor

@yinxusen I'll have a look later today

asfgit pushed a commit that referenced this pull request Dec 9, 2015
…de_example

PR on behalf of somideshmukh, thanks!

Author: Xusen Yin <yinxusen@gmail.com>
Author: somideshmukh <somilde@us.ibm.com>

Closes #10219 from yinxusen/SPARK-11551.

(cherry picked from commit 051c6a0)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
@mengxr
Copy link
Contributor

mengxr commented Dec 9, 2015

Merged into master and branch-1.6. Thanks!

DataFrame dctDf = dct.transform(df);
dctDf.select("featuresDCT").show(3);
{% endhighlight %}
{% include_example java/org/apache/spark/examples/ml/JavaDCTExample.java %}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the extra } at the end.

@asfgit asfgit closed this in 051c6a0 Dec 9, 2015
DataFrame binarizedDataFrame = binarizer.transform(continuousDataFrame);
DataFrame binarizedFeatures = binarizedDataFrame.select("binarized_feature");
for (Row r : binarizedFeatures.collect()) {
Double binarized_value = r.getDouble(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

indent

@BenFradet
Copy link
Contributor

LGTM, except two minor comments.

@yinxusen
Copy link
Contributor Author

@BenFradet I'll change it in the follow-up PR #10193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants