/** * Constructor. The mixture model will be learned from the given data with the * EM algorithm. * @param mixture the initial guess of mixture. Components may have * different distribution form. * @param data the training data. */ public ExponentialFamilyMixture(List<Component> mixture, double[] data) { this(mixture); EM(components, data); }
/** * Standard EM algorithm which iteratively alternates * Expectation and Maximization steps until convergence. * * @param mixture the initial configuration. * @param x the input data. * @return log Likelihood */ double EM(List<Component> mixture, double[] x) { return EM(mixture, x, 0.0); }
/** * Standard EM algorithm which iteratively alternates * Expectation and Maximization steps until convergence. * * @param mixture the initial configuration. * @param x the input data. * @param gamma the regularization parameter. Although regularization works * well for high dimensional data, it often reduces the model * to too few components. For one-dimensional data, gamma should * be 0 in general. * @return log Likelihood */ double EM(List<Component> mixture, double[] x, double gamma) { return EM(mixture, x, gamma, Integer.MAX_VALUE); }