Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/7029#discussion_r33435600
--- Diff: docs/mllib-feature-extraction.md ---
@@ -451,19 +452,20 @@ JavaRDD<LabeledPoint> points =
MLUtils.loadLibSVMFile(sc.sc(),
"data/mllib/sample_libsvm_data.txt").toJavaRDD().cache();
// Discretize data in 16 equal bins since ChiSqSelector requires
categorical features
+// Even though features are doubles, the ChiSqSelector treats each unique
value as a category
JavaRDD<LabeledPoint> discretizedData = points.map(
new Function<LabeledPoint, LabeledPoint>() {
@Override
public LabeledPoint call(LabeledPoint lp) {
final double[] discretizedFeatures = new
double[lp.features().size()];
for (int i = 0; i < lp.features().size(); ++i) {
- discretizedFeatures[i] = lp.features().apply(i) / 16;
+ discretizedFeatures[i] = Math.floor(lp.features().apply(i) /
16);
--- End diff --
do not use tab
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]