Package weka.core

Examples of weka.core.SelectedTag


    int counter = 0;
    do {
      try {
  return m_Evaluation.getTrainTestPredictions(dc, train, test);
      } catch (UnsupportedAttributeTypeException ex) {
  SelectedTag tag = null;
  boolean invert = false;
  String msg = ex.getMessage();
  if ((msg.indexOf("string") != -1) &&
      (msg.indexOf("attributes") != -1)) {
    System.err.println("\nDeleting string attributes.");
    tag = new SelectedTag(Attribute.STRING,
        RemoveType.TAGS_ATTRIBUTETYPE);
  } else if ((msg.indexOf("only") != -1) &&
       (msg.indexOf("nominal") != -1)) {
    System.err.println("\nDeleting non-nominal attributes.");
    tag = new SelectedTag(Attribute.NOMINAL,
        RemoveType.TAGS_ATTRIBUTETYPE);
    invert = true;
  } else if ((msg.indexOf("only") != -1) &&
       (msg.indexOf("numeric") != -1)) {
    System.err.println("\nDeleting non-numeric attributes.");
    tag = new SelectedTag(Attribute.NUMERIC,
        RemoveType.TAGS_ATTRIBUTETYPE);
    invert = true;
  else {
    throw ex;
  }
View Full Code Here


  }

  public void testRangeNone() throws Exception {
   
    int cind = 0;
    ((ThresholdSelector)m_Classifier).setDesignatedClass(new SelectedTag(ThresholdSelector.OPTIMIZE_0, ThresholdSelector.TAGS_OPTIMIZE));
    ((ThresholdSelector)m_Classifier).setRangeCorrection(new SelectedTag(ThresholdSelector.RANGE_NONE, ThresholdSelector.TAGS_RANGE));
    FastVector result = null;
    m_Instances.setClassIndex(1);
    result = useClassifier();
    assertTrue(result.size() != 0);
    double minp = 0;
View Full Code Here

 
  public void testDesignatedClass() throws Exception {
   
    int cind = 0;
    for (int i = 0; i < ThresholdSelector.TAGS_OPTIMIZE.length; i++) {
      ((ThresholdSelector)m_Classifier).setDesignatedClass(new SelectedTag(ThresholdSelector.TAGS_OPTIMIZE[i].getID(), ThresholdSelector.TAGS_OPTIMIZE));
      m_Instances.setClassIndex(1);
      FastVector result = useClassifier();
      assertTrue(result.size() != 0);
    }
  }
View Full Code Here

  public void testEvaluationMode() throws Exception {
   
    int cind = 0;
    for (int i = 0; i < ThresholdSelector.TAGS_EVAL.length; i++) {
      ((ThresholdSelector)m_Classifier).setEvaluationMode(new SelectedTag(ThresholdSelector.TAGS_EVAL[i].getID(), ThresholdSelector.TAGS_EVAL));
      m_Instances.setClassIndex(1);
      FastVector result = useClassifier();
      assertTrue(result.size() != 0);
    }
  }
View Full Code Here

   * @return an enumeration of all the available options.
   */
  public Enumeration listOptions() {
    Vector     newVector;
    String    desc;
    SelectedTag    tag;
    int      i;

    newVector = new Vector();

    desc  = "";
    for (i = 0; i < TAGS_TYPE.length; i++) {
      tag = new SelectedTag(TAGS_TYPE[i].getID(), TAGS_TYPE);
      desc  +=   "\t" + tag.getSelectedTag().getIDStr()
               + " = " + tag.getSelectedTag().getReadable()
               + "\n";
    }
    newVector.addElement(new Option(
  "\tThe type of attribute to create:\n"
  + desc
  +"\t(default: " + new SelectedTag(Attribute.NUMERIC, TAGS_TYPE) + ")",
  "T", 1, "-T " + Tag.toOptionList(TAGS_TYPE)));

    newVector.addElement(new Option(
  "\tSpecify where to insert the column. First and last\n"
  +"\tare valid indexes.(default: last)",
View Full Code Here

  public void setOptions(String[] options) throws Exception {
    String  tmpStr;

    tmpStr = Utils.getOption('T', options);
    if (tmpStr.length() != 0)
      setAttributeType(new SelectedTag(tmpStr, TAGS_TYPE));
    else
      setAttributeType(new SelectedTag(Attribute.NUMERIC, TAGS_TYPE));
   
    tmpStr = Utils.getOption('C', options);
    if (tmpStr.length() == 0)
      tmpStr = "last";
    setAttributeIndex(tmpStr);
View Full Code Here

   * Gets the type of attribute to generate.
   *
   * @return     the current attribute type.
   */
  public SelectedTag getAttributeType() {
    return new SelectedTag(m_AttributeType, TAGS_TYPE);
  }
View Full Code Here

        for (int i = 0; i < numFolds; i++) {
          Instances train = m_Instances.trainCV(numFolds, i, random);
          SerializedObject so = new SerializedObject(this);
          BayesianLogisticRegression blr = (BayesianLogisticRegression) so.getObject();
          //          blr.setHyperparameterSelection(3);
          blr.setHyperparameterSelection(new SelectedTag(SPECIFIC_VALUE,
                                                         TAGS_HYPER_METHOD));
          blr.setHyperparameterValue(list[k]);
          //          blr.setPriorClass(PriorClass);
          blr.setPriorClass(new SelectedTag(PriorClass,
                                            TAGS_PRIOR));
          blr.setThreshold(Threshold);
          blr.setTolerance(Tolerance);
          blr.buildClassifier(train);
View Full Code Here

   * Get the method used to select the hyperparameter
   *
   * @return the method used to select the hyperparameter
   */
  public SelectedTag getHyperparameterSelection() {
    return new SelectedTag(HyperparameterSelection,
                           TAGS_HYPER_METHOD);
  }
View Full Code Here

   * Get the type of prior to use.
   *
   * @return the type of prior to use
   */
  public SelectedTag getPriorClass() {
    return new SelectedTag(PriorClass,
                           TAGS_PRIOR);
  }
View Full Code Here

TOP

Related Classes of weka.core.SelectedTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.