[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-27 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r339354617
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussian.java
 ##
 @@ -0,0 +1,148 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.BLAS;
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+import org.apache.flink.ml.common.linalg.SparseVector;
+import org.apache.flink.ml.common.linalg.Vector;
+
+import com.github.fommil.netlib.LAPACK;
+import org.netlib.util.intW;
+
+/**
+ * This class provides basic functionality for a Multivariate Gaussian 
(Normal) Distribution.
+ */
+public class MultivariateGaussian {
+
+   private static final LAPACK LAPACK_INST = LAPACK.getInstance();
+   private static final double EPSILON;
+
+   static {
+   double eps = 1.0;
+   while ((1.0 + (eps / 2.0)) != 1.0) {
+   eps /= 2.0;
+   }
+   EPSILON = eps;
+   }
+
+   private final DenseVector mean;
+   private final DenseMatrix cov;
+
+   private DenseMatrix rootSigmaInv;
+   private double u;
+
+   // data buffers for computing pdf
+   private DenseVector delta;
+   private DenseVector v;
+
+   /**
+* The constructor.
+*
+* @param mean The mean vector of the distribution.
+* @param cov  The covariance matrix of the distribution.
+*/
+   public MultivariateGaussian(DenseVector mean, DenseMatrix cov) {
+   this.mean = mean;
+   this.cov = cov;
+   this.delta = DenseVector.zeros(mean.size());
+   this.v = DenseVector.zeros(mean.size());
+   calculateCovarianceConstants();
+   }
+
+   /**
+* Returns density of this multivariate Gaussian at given point, x.
+*/
+   public double pdf(Vector x) {
+   return Math.exp(logpdf(x));
+   }
+
+   /**
+* Returns the log-density of this multivariate Gaussian at given 
point, x.
+*/
+   public double logpdf(Vector x) {
+   int n = mean.size();
+   System.arraycopy(mean.getData(), 0, delta.getData(), 0, n);
+   BLAS.scal(-1.0, delta);
+   if (x instanceof DenseVector) {
+   BLAS.axpy(1., (DenseVector) x, delta);
+   } else if (x instanceof SparseVector) {
+   BLAS.axpy(1., (SparseVector) x, delta);
+   }
+   BLAS.gemv(1.0, rootSigmaInv, false, delta, 0., v);
+   return u - 0.5 * BLAS.dot(v, v);
+   }
+
+   /**
+* Compute distribution dependent constants.
+*
+* The probability density function is calculated as:
+* pdf(x) = (2*pi)^(-k/2)^ * det(sigma)^(-1/2)^ * exp((-1/2) * (x-mu).t 
* inv(sigma) * (x-mu))
+*
+* Here we compute the following distribution dependent constants 
that can be reused in each pdf computation:
+* A) u = log((2*pi)^(-k/2)^ * det(sigma)^(-1/2)^)
+* B) rootSigmaInv = sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+*
+* 
+*  sigma = U * D * U.t
+*  inv(sigma) = U * inv(D) * U.t = (D^{-1/2}^ * U.t).t * 
(D^{-1/2}^ * U.t)
+*  sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+* 
+*/
+   private void calculateCovarianceConstants() {
+   int n = this.mean.size();
+   int lwork = 3 * n - 1;
+   double[] matA = new double[n * n];
+   double[] work = new double[lwork];
+   double[] evs = new double[n];
+   intW info = new intW(0);
+
+   for (int i = 0; i < n; i++) {
+   System.arraycopy(cov.getData(), i * n, matA, i * n, i + 
1);
+   }
+   LAPACK_INST.dsyev("V", "U", n, matA, n, evs, work, lwork, info);
+
+   

[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-27 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r339354266
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussian.java
 ##
 @@ -0,0 +1,148 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.BLAS;
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+import org.apache.flink.ml.common.linalg.SparseVector;
+import org.apache.flink.ml.common.linalg.Vector;
+
+import com.github.fommil.netlib.LAPACK;
+import org.netlib.util.intW;
+
+/**
+ * This class provides basic functionality for a Multivariate Gaussian 
(Normal) Distribution.
+ */
+public class MultivariateGaussian {
+
+   private static final LAPACK LAPACK_INST = LAPACK.getInstance();
+   private static final double EPSILON;
+
+   static {
+   double eps = 1.0;
+   while ((1.0 + (eps / 2.0)) != 1.0) {
+   eps /= 2.0;
+   }
+   EPSILON = eps;
+   }
+
+   private final DenseVector mean;
+   private final DenseMatrix cov;
+
+   private DenseMatrix rootSigmaInv;
+   private double u;
 
 Review comment:
   members can be `final`?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-27 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r339354298
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/test/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussianTest.java
 ##
 @@ -0,0 +1,57 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test cases for MultivariateGaussian.
+ */
+public class MultivariateGaussianTest {
+   private static final double TOL = 1.0e-5;
+
 
 Review comment:
   add test for `Univariate` as well just in case?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-27 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r339354650
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussian.java
 ##
 @@ -0,0 +1,148 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.BLAS;
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+import org.apache.flink.ml.common.linalg.SparseVector;
+import org.apache.flink.ml.common.linalg.Vector;
+
+import com.github.fommil.netlib.LAPACK;
+import org.netlib.util.intW;
+
+/**
+ * This class provides basic functionality for a Multivariate Gaussian 
(Normal) Distribution.
+ */
+public class MultivariateGaussian {
+
+   private static final LAPACK LAPACK_INST = LAPACK.getInstance();
+   private static final double EPSILON;
+
+   static {
+   double eps = 1.0;
+   while ((1.0 + (eps / 2.0)) != 1.0) {
+   eps /= 2.0;
+   }
+   EPSILON = eps;
+   }
+
+   private final DenseVector mean;
+   private final DenseMatrix cov;
+
+   private DenseMatrix rootSigmaInv;
+   private double u;
+
+   // data buffers for computing pdf
+   private DenseVector delta;
+   private DenseVector v;
+
+   /**
+* The constructor.
+*
+* @param mean The mean vector of the distribution.
+* @param cov  The covariance matrix of the distribution.
+*/
+   public MultivariateGaussian(DenseVector mean, DenseMatrix cov) {
+   this.mean = mean;
+   this.cov = cov;
+   this.delta = DenseVector.zeros(mean.size());
+   this.v = DenseVector.zeros(mean.size());
+   calculateCovarianceConstants();
+   }
+
+   /**
+* Returns density of this multivariate Gaussian at given point, x.
+*/
+   public double pdf(Vector x) {
+   return Math.exp(logpdf(x));
+   }
+
+   /**
+* Returns the log-density of this multivariate Gaussian at given 
point, x.
+*/
+   public double logpdf(Vector x) {
+   int n = mean.size();
+   System.arraycopy(mean.getData(), 0, delta.getData(), 0, n);
+   BLAS.scal(-1.0, delta);
+   if (x instanceof DenseVector) {
+   BLAS.axpy(1., (DenseVector) x, delta);
+   } else if (x instanceof SparseVector) {
+   BLAS.axpy(1., (SparseVector) x, delta);
+   }
+   BLAS.gemv(1.0, rootSigmaInv, false, delta, 0., v);
+   return u - 0.5 * BLAS.dot(v, v);
+   }
+
+   /**
+* Compute distribution dependent constants.
+*
+* The probability density function is calculated as:
+* pdf(x) = (2*pi)^(-k/2)^ * det(sigma)^(-1/2)^ * exp((-1/2) * (x-mu).t 
* inv(sigma) * (x-mu))
+*
+* Here we compute the following distribution dependent constants 
that can be reused in each pdf computation:
+* A) u = log((2*pi)^(-k/2)^ * det(sigma)^(-1/2)^)
+* B) rootSigmaInv = sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+*
+* 
+*  sigma = U * D * U.t
+*  inv(sigma) = U * inv(D) * U.t = (D^{-1/2}^ * U.t).t * 
(D^{-1/2}^ * U.t)
+*  sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+* 
+*/
+   private void calculateCovarianceConstants() {
+   int n = this.mean.size();
+   int lwork = 3 * n - 1;
+   double[] matA = new double[n * n];
+   double[] work = new double[lwork];
+   double[] evs = new double[n];
+   intW info = new intW(0);
+
+   for (int i = 0; i < n; i++) {
+   System.arraycopy(cov.getData(), i * n, matA, i * n, i + 
1);
+   }
+   LAPACK_INST.dsyev("V", "U", n, matA, n, evs, work, lwork, info);
+
+   

[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-27 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r339354278
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussian.java
 ##
 @@ -0,0 +1,148 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.BLAS;
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+import org.apache.flink.ml.common.linalg.SparseVector;
+import org.apache.flink.ml.common.linalg.Vector;
+
+import com.github.fommil.netlib.LAPACK;
+import org.netlib.util.intW;
+
+/**
+ * This class provides basic functionality for a Multivariate Gaussian 
(Normal) Distribution.
+ */
+public class MultivariateGaussian {
+
+   private static final LAPACK LAPACK_INST = LAPACK.getInstance();
+   private static final double EPSILON;
+
+   static {
+   double eps = 1.0;
+   while ((1.0 + (eps / 2.0)) != 1.0) {
+   eps /= 2.0;
+   }
+   EPSILON = eps;
+   }
+
+   private final DenseVector mean;
+   private final DenseMatrix cov;
+
+   private DenseMatrix rootSigmaInv;
+   private double u;
+
+   // data buffers for computing pdf
+   private DenseVector delta;
+   private DenseVector v;
+
+   /**
+* The constructor.
+*
+* @param mean The mean vector of the distribution.
+* @param cov  The covariance matrix of the distribution.
+*/
+   public MultivariateGaussian(DenseVector mean, DenseMatrix cov) {
+   this.mean = mean;
+   this.cov = cov;
+   this.delta = DenseVector.zeros(mean.size());
+   this.v = DenseVector.zeros(mean.size());
+   calculateCovarianceConstants();
+   }
+
+   /**
+* Returns density of this multivariate Gaussian at given point, x.
+*/
+   public double pdf(Vector x) {
+   return Math.exp(logpdf(x));
+   }
+
+   /**
+* Returns the log-density of this multivariate Gaussian at given 
point, x.
+*/
+   public double logpdf(Vector x) {
+   int n = mean.size();
+   System.arraycopy(mean.getData(), 0, delta.getData(), 0, n);
+   BLAS.scal(-1.0, delta);
+   if (x instanceof DenseVector) {
+   BLAS.axpy(1., (DenseVector) x, delta);
+   } else if (x instanceof SparseVector) {
+   BLAS.axpy(1., (SparseVector) x, delta);
+   }
+   BLAS.gemv(1.0, rootSigmaInv, false, delta, 0., v);
+   return u - 0.5 * BLAS.dot(v, v);
+   }
+
+   /**
+* Compute distribution dependent constants.
+*
+* The probability density function is calculated as:
+* pdf(x) = (2*pi)^(-k/2)^ * det(sigma)^(-1/2)^ * exp((-1/2) * (x-mu).t 
* inv(sigma) * (x-mu))
+*
+* Here we compute the following distribution dependent constants 
that can be reused in each pdf computation:
+* A) u = log((2*pi)^(-k/2)^ * det(sigma)^(-1/2)^)
+* B) rootSigmaInv = sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+*
+* 
+*  sigma = U * D * U.t
+*  inv(sigma) = U * inv(D) * U.t = (D^{-1/2}^ * U.t).t * 
(D^{-1/2}^ * U.t)
+*  sqrt(inv(sigma)) = D^(-1/2)^ * U.t
+* 
+*/
+   private void calculateCovarianceConstants() {
+   int n = this.mean.size();
+   int lwork = 3 * n - 1;
+   double[] matA = new double[n * n];
+   double[] work = new double[lwork];
+   double[] evs = new double[n];
+   intW info = new intW(0);
+
+   for (int i = 0; i < n; i++) {
+   System.arraycopy(cov.getData(), i * n, matA, i * n, i + 
1);
+   }
 
 Review comment:
   `System.arraycopy(cov.getData(), 0, matA, 0, n*n);`?


[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-22 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r337847736
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/main/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussian.java
 ##
 @@ -0,0 +1,138 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.BLAS;
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+import org.apache.flink.ml.common.linalg.SparseVector;
+import org.apache.flink.ml.common.linalg.Vector;
+
+import com.github.fommil.netlib.LAPACK;
+import org.netlib.util.intW;
+
+/**
+ * This class provides basic functionality for a Multivariate Gaussian 
(Normal) Distribution.
+ */
+public class MultivariateGaussian {
+
+   private static final LAPACK LAPACK_INST = LAPACK.getInstance();
+   private static final double EPSILON;
+
+   static {
+   double eps = 1.0;
+   while ((1.0 + (eps / 2.0)) != 1.0) {
+   eps /= 2.0;
+   }
+   EPSILON = eps;
+   }
+
+   private final DenseVector mean;
+   private final DenseMatrix cov;
+
+   private DenseMatrix rootSigmaInv;
+   private double u;
+
+   // data buffers for computing pdf
+   private DenseVector delta;
+   private DenseVector v;
+
+   /**
+* The constructor.
+*
+* @param mean The mean vector of the distribution.
+* @param cov  The covariance matrix of the distribution.
+*/
+   public MultivariateGaussian(DenseVector mean, DenseMatrix cov) {
+   this.mean = mean;
+   this.cov = cov;
+   this.delta = DenseVector.zeros(mean.size());
+   this.v = DenseVector.zeros(mean.size());
+   calculateCovarianceConstants();
+   }
+
+   /**
+* Returns density of this multivariate Gaussian at given point, x.
+*/
+   public double pdf(Vector x) {
+   return Math.exp(logpdf(x));
+   }
+
+   /**
+* Returns the log-density of this multivariate Gaussian at given 
point, x.
+*/
+   public double logpdf(Vector x) {
+   int n = mean.size();
+   System.arraycopy(mean.getData(), 0, delta.getData(), 0, n);
+   BLAS.scal(-1.0, delta);
+   if (x instanceof DenseVector) {
+   BLAS.axpy(1., (DenseVector) x, delta);
+   } else if (x instanceof SparseVector) {
+   BLAS.axpy(1., (SparseVector) x, delta);
+   }
+   BLAS.gemv(1.0, rootSigmaInv, false, delta, 0., v);
+   return u - 0.5 * BLAS.dot(v, v);
+   }
+
+   /**
+* Compute distribution dependent constants.
+*
+* rootSigmaInv = D^(-1/2)^ * U.t, where sigma = U * D * U.t .
 
 Review comment:
   much more informatively: 
   ```
* 
*  sigma = U * D * U.t
*  inv(Sigma) = U * inv(D) * U.t = = (D^{-1/2}^ * U.t).t * (D^{-1/2}^ * 
U.t)
*  sqrt(inv(Sigma)) = D^(-1/2)^ * U.t
* 
   ```
   
   since the word `rootSigmaInv` is not intuitively understandable to me. 
(especially "root" doesn't mean square-root)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [flink] walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add the class for multivariate Gaussian Distribution.

2019-10-22 Thread GitBox
walterddr commented on a change in pull request #9733: [FLINK-14154][ml] Add 
the class for multivariate Gaussian Distribution.
URL: https://github.com/apache/flink/pull/9733#discussion_r337846841
 
 

 ##
 File path: 
flink-ml-parent/flink-ml-lib/src/test/java/org/apache/flink/ml/common/statistics/basicstatistic/MultivariateGaussianTest.java
 ##
 @@ -0,0 +1,57 @@
+/*
+ * 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.flink.ml.common.statistics.basicstatistic;
+
+import org.apache.flink.ml.common.linalg.DenseMatrix;
+import org.apache.flink.ml.common.linalg.DenseVector;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test cases for MultivariateGaussian.
+ */
+public class MultivariateGaussianTest {
+   private static final double TOL = 1.0e-5;
 
 Review comment:
   Is there a reason why we use a fixed `TOL` while during the actual execution 
we use the limited bi-section to determine the actual TOL for the system?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services