# spark-reviews mailing list archives

##### Site index · List index
Message view
Top
Subject [GitHub] spark pull request: SPARK-5018 [MLlib] [WIP] Make MultivariateGaus...
Date Wed, 07 Jan 2015 22:48:15 GMT
```Github user jkbradley commented on a diff in the pull request:

https://github.com/apache/spark/pull/3923#discussion_r22623118

--- Diff: mllib/src/main/scala/org/apache/spark/mllib/stat/impl/MultivariateGaussian.scala
---
@@ -30,22 +31,57 @@ import org.apache.spark.mllib.util.MLUtils
* @param mu The mean vector of the distribution
* @param sigma The covariance matrix of the distribution
*/
-private[mllib] class MultivariateGaussian(
+class MultivariateGaussian private[mllib] (
val mu: DBV[Double],
val sigma: DBM[Double]) extends Serializable {

/**
+   * Public constructor
+   *
+   * @param mu The mean vector of the distribution
+   * @param sigma The covariance matrix of the distribution
+   */
+  def this(mu: Vector, sigma: Matrix) = {
+    this(mu.toBreeze.toDenseVector, sigma.toBreeze.toDenseMatrix)
+  }
+
+  /**
* Compute distribution dependent constants:
*    rootSigmaInv = D^(-1/2) * U, where sigma = U * D * U.t
-   *    u = (2*pi)^(-k/2) * det(sigma)^(-1/2)
+   *    u = log((2*pi)^(-k/2) * det(sigma)^(-1/2))
*/
private val (rootSigmaInv: DBM[Double], u: Double) = calculateCovarianceConstants

+  /** Return the mean vector for this distribution */
--- End diff --

I'd include "mu" in the doc since it's such a common variable name.

---
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