Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/1367#discussion_r15133828
--- Diff: mllib/src/main/scala/org/apache/spark/mllib/stat/Statistics.scala
---
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.mllib.stat
+
+import org.apache.spark.annotation.Experimental
+import org.apache.spark.mllib.linalg.{Matrix, Vector}
+import org.apache.spark.mllib.stat.correlation.Correlations
+import org.apache.spark.rdd.RDD
+
+/**
+ * API for statistical functions in MLlib
+ */
+@Experimental
+object Statistics {
+
+ /**
+ * Compute the Pearson correlation matrix for the input RDD of Vectors.
+ * Returns NaN if either vector has 0 variance.
+ *
+ * @param X an RDD[Vector] for which the correlation matrix is to be
computed.
+ * @return Pearson correlation matrix comparing columns in X.
+ */
+ def corr(X: RDD[Vector]): Matrix = Correlations.corrMatrix(X)
+
+ /**
+ * Compute the correlation matrix for the input RDD of Vectors using the
specified method.
+ * Methods currently supported: pearson (default), spearman
+ *
+ * Note that for Spearman, a rank correlation, we need to create an
RDD[Double] for each column
+ * and sort it in order to retrieve the ranks and then join the columns
back into an RDD[Vector],
+ * which is fairly costly. Cache the input RDD before calling corr with
`method = "spearman"` to
+ * avoid recomputing the common lineage
--- End diff --
Missing `.` at the end.
---
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.
---