//Source file: D:\\Projects\\src\\yi\\iu\\imgdb\\learn\\em\\EMLikeAdapter.java

package yi.iu.imgdb.learn.em;

import java.util.*;
import yi.util.data.*;
import yi.stat.em.*;
import yi.iu.imgdb.learn.*;
import yi.ds.hash.*;
import yi.util.io.*;
import yi.util.config.*;
import org.jmat.gui.*;

/**
 * Implement the "EM" like learning on image keywords (idea suggested by Jeff)
 */
public class GMMMMAdapter extends MixtureModelAdapter implements FeatureScoringCapable
{
  public int NUM_COMP_IN_GMM_COMP= 8;
  public double BREAK_T_IN_GMM_COMP = 1e-6;
  public double BREAK_T_IN_OUTER = 1e-5;

  public GMMMMAdapter(ImgDataCenter data_center, LinkedList img_list,
                       LinkedList ft_list, LinkedList obj_list) {
    super(data_center, img_list, ft_list, obj_list);
    Configuration.configParameters(this);
  }

  public String[] getParameterNames() {
     String[] parameters = new String[] {
         "NUM_COMP_IN_GMM_COMP",
         "BREAK_T_IN_GMM_COMP",
         "BREAK_T_IN_OUTER"
     };
     String[] parent_param = super.getParameterNames();
     return Configuration.combineParameterNames(parameters, parent_param);
  }

  /**
   * GMMAdapter use GMMMixtureModel (mixture of Gaussian mixtures)
   * @param fvList
   * @param objList
   * @return
   */
  protected MixtureModel createMixtureModel(HashMap fvList, HashMap objList) {
    GMMMixtureModel gmmmm = new GMMMixtureModel(m_imgFvList, m_imgObjList, BREAK_T_IN_OUTER, NUM_COMP_IN_GMM_COMP, BREAK_T_IN_GMM_COMP);
    return gmmmm;
  }
}
