Class MultivariateGaussianModel

    • Field Detail

      • LOG

        private static final Logging LOG
        Class logger.
      • SINGULARITY_CHEAT

        private static final double SINGULARITY_CHEAT
        Constant to avoid singular matrixes.
        See Also:
        Constant Field Values
      • mean

        double[] mean
        Mean vector.
      • covariance

        double[][] covariance
        Covariance matrix.
      • nmea

        double[] nmea
        Temporary storage, to avoid reallocations.
      • logNorm

        double logNorm
        Normalization factor.
      • logNormDet

        double logNormDet
        Normalization factor.
      • weight

        double weight
        Weight aggregation sum.
      • wsum

        double wsum
        Weight aggregation sum.
      • priormatrix

        double[][] priormatrix
        Matrix for prior conditioning.
    • Constructor Detail

      • MultivariateGaussianModel

        public MultivariateGaussianModel​(double weight,
                                         double[] mean)
        Constructor.
        Parameters:
        weight - Cluster weight
        mean - Initial mean
      • MultivariateGaussianModel

        public MultivariateGaussianModel​(double weight,
                                         double[] mean,
                                         double[][] covariance)
        Constructor.
        Parameters:
        weight - Cluster weight
        mean - Initial mean
        covariance - Initial covariance matrix
    • Method Detail

      • finalizeEStep

        public void finalizeEStep​(double weight,
                                  double prior)
        Description copied from interface: EMClusterModel
        Finalize the E step.
        Specified by:
        finalizeEStep in interface EMClusterModel<NumberVector,​EMModel>
        Parameters:
        weight - weight of the cluster
        prior - MAP prior (0 for MLE)
      • updateCholesky

        protected static CholeskyDecomposition updateCholesky​(double[][] covariance,
                                                              CholeskyDecomposition prev)
        Update the cholesky decomposition.
        Parameters:
        covariance - Covariance matrix
        prev - Previous Cholesky decomposition (reused in case of instability)
        Returns:
        New Cholesky decomposition
      • getHalfLogDeterminant

        protected static double getHalfLogDeterminant​(CholeskyDecomposition chol)
        Get 0.5 * log(det) of a cholesky decomposition.
        Parameters:
        chol - Cholesky Decomposition
        Returns:
        log determinant.
      • mahalanobisDistance

        public double mahalanobisDistance​(double[] vec)
        Compute the Mahalanobis distance from the centroid for a given vector.
        Parameters:
        vec - Vector
        Returns:
        Mahalanobis distance
      • mahalanobisDistance

        public double mahalanobisDistance​(NumberVector vec)
        Compute the Mahalanobis distance from the centroid for a given vector.

        Note: used by P3C.

        Parameters:
        vec - Vector
        Returns:
        Mahalanobis distance
      • updateE

        public void updateE​(ClusterFeature cf,
                            double wei)
        Description copied from interface: BetulaClusterModel
        Process one clustering feature in the E step.
        Specified by:
        updateE in interface BetulaClusterModel
        Parameters:
        cf - Clustering feature to process.
        wei - weight of the clustering feature.