Return-Path: X-Original-To: apmail-spark-reviews-archive@minotaur.apache.org Delivered-To: apmail-spark-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C22EC1010B for ; Wed, 7 Jan 2015 22:48:16 +0000 (UTC) Received: (qmail 13734 invoked by uid 500); 7 Jan 2015 22:48:18 -0000 Delivered-To: apmail-spark-reviews-archive@spark.apache.org Received: (qmail 13708 invoked by uid 500); 7 Jan 2015 22:48:17 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 13666 invoked by uid 99); 7 Jan 2015 22:48:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2015 22:48:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 3D65E9D2DA4; Wed, 7 Jan 2015 22:48:15 +0000 (UTC) From: jkbradley To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request: SPARK-5018 [MLlib] [WIP] Make MultivariateGaus... Content-Type: text/plain Message-Id: <20150107224815.3D65E9D2DA4@tyr.zones.apache.org> Date: Wed, 7 Jan 2015 22:48:15 +0000 (UTC) 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 For additional commands, e-mail: reviews-help@spark.apache.org