package myweka;

import java.util.*;
import weka.core.*;
import weka.classifiers.*;

/**
 * @author robbyjo
 *
 */
public class CandidateElim extends Classifier {

  private LinkedList slist, glist;
  private int trueValue = 0;

  /**
   * Builds Candidate Elimination  classifier.
   *
   * @param data the training data
   * @exception Exception if classifier can't be built successfully
   */
  public void buildClassifier(Instances data) throws Exception {
     slist = new LinkedList(); // initialize both s and g to an empty list
     glist = new LinkedList();

     Attribute classAttribute = data.classAttribute();
     trueValue = classAttribute.indexOfValue("yes");
     for (Enumeration e = data.enumerateInstances(); e.hasMoreElements(); ) {
         Instance instance = (Instance) e.nextElement();
         if (instance.classValue() == trueValue) {
             // This row of data says "yes"
         } else {
             // This row of data says "no"
         }
     }
  }

  /**
   * Classifies a given test instance using the lattice.
   *
   * @param instance the instance to be classified
   * @return the classification
   */
  public double classifyInstance(Instance instance) {
     return trueValue;
  }

  /**
   * Main method.
   *
   * @param args the options for the classifier
   */
  public static void main(String[] args) {

    try {
      System.out.println(Evaluation.evaluateModel(new CandidateElim(), args));
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
  }
}


