Package java.util

Examples of java.util.Vector


   * Returns an enumeration of any additional measure names that might be
   * in the classifier
   * @return an enumeration of the measure names
   */
  public Enumeration enumerateMeasures() {
    Vector newVector = new Vector();
    if (m_Template instanceof AdditionalMeasureProducer) {
      Enumeration en = ((AdditionalMeasureProducer)m_Template).
  enumerateMeasures();
      while (en.hasMoreElements()) {
  String mname = (String)en.nextElement();
  newVector.addElement(mname);
      }
    }
    return newVector.elements();
  }
View Full Code Here


        Instances tempHeader = null;
        // KOML ?
        if ((KOML.isPresent()) &&
            (loadFrom.getAbsolutePath().toLowerCase().
             endsWith(KOML.FILE_EXTENSION + FILE_EXTENSION))) {
          Vector v = (Vector) KOML.read(loadFrom.getAbsolutePath());
          temp = (weka.classifiers.Classifier) v.elementAt(0);
          if (v.size() == 2) {
            // try and grab the header
            tempHeader = (Instances) v.elementAt(1);
          }
        } /* XStream */ else if ((XStream.isPresent()) &&
                                 (loadFrom.getAbsolutePath().toLowerCase().
                                  endsWith(XStream.FILE_EXTENSION + FILE_EXTENSION))) {
          Vector v = (Vector) XStream.read(loadFrom.getAbsolutePath());
          temp = (weka.classifiers.Classifier) v.elementAt(0);
          if (v.size() == 2) {
            // try and grab the header
            tempHeader = (Instances) v.elementAt(1);
          }
        } /* binary */ else {

          ObjectInputStream is =
            new ObjectInputStream(new BufferedInputStream(
View Full Code Here

   * Return an enumeration of requests that can be made by the user
   *
   * @return an <code>Enumeration</code> value
   */
  public Enumeration enumerateRequests() {
    Vector newVector = new Vector(0);
    if (m_executorPool != null &&
        (m_executorPool.getQueue().size() > 0 ||
            m_executorPool.getActiveCount() > 0)) {
      newVector.addElement("Stop");
    }

    if ((m_executorPool == null ||
        (m_executorPool.getQueue().size() == 0 &&
            m_executorPool.getActiveCount() == 0)) &&
        m_Classifier != null) {
      newVector.addElement("Save model");
    }

    if (m_executorPool == null ||
        (m_executorPool.getQueue().size() == 0 &&
            m_executorPool.getActiveCount() == 0)) {
      newVector.addElement("Load model");
    }
    return newVector.elements();
  }
View Full Code Here

   *
   * @return an enumeration of the measure names
   */
  public Enumeration enumerateMeasures() {
   
    Vector newVector = new Vector(1);
    newVector.addElement("measureOutOfBagError");
    return newVector.elements();
  }
View Full Code Here

   *
   * @return an enumeration of all the available options
   */
  public Enumeration listOptions() {
   
    Vector newVector = new Vector();

    newVector.addElement(new Option(
  "\tNumber of trees to build.",
  "I", 1, "-I <number of trees>"));
   
    newVector.addElement(new Option(
  "\tNumber of features to consider (<1=int(logM+1)).",
  "K", 1, "-K <number of features>"));
   
    newVector.addElement(new Option(
  "\tSeed for random number generator.\n"
  + "\t(default 1)",
  "S", 1, "-S"));

    newVector.addElement(new Option(
  "\tThe maximum depth of the trees, 0 for unlimited.\n"
  + "\t(default 0)",
  "depth", 1, "-depth <num>"));

    Enumeration enu = super.listOptions();
    while (enu.hasMoreElements()) {
      newVector.addElement(enu.nextElement());
    }

    return newVector.elements();
  }
View Full Code Here

   * Gets the current settings of the forest.
   *
   * @return an array of strings suitable for passing to setOptions()
   */
  public String[] getOptions() {
    Vector        result;
    String[]      options;
    int           i;
   
    result = new Vector();
   
    result.add("-I");
    result.add("" + getNumTrees());
   
    result.add("-K");
    result.add("" + getNumFeatures());
   
    result.add("-S");
    result.add("" + getSeed());
   
    if (getMaxDepth() > 0) {
      result.add("-depth");
      result.add("" + getMaxDepth());
    }
   
    options = super.getOptions();
    for (i = 0; i < options.length; i++)
      result.add(options[i]);
   
    return (String[]) result.toArray(new String[result.size()]);
  }
View Full Code Here

   *
   * @return an enumeration of all the available options.
   */
  public Enumeration listOptions() {

    Vector newVector = new Vector(1);

    newVector.addElement(new Option(
       "\tThe full class name of the classifier.\n"
        +"\teg: weka.classifiers.bayes.NaiveBayes",
       "W", 1,
       "-W <class name>"));

    if ((m_Template != null) &&
  (m_Template instanceof OptionHandler)) {
      newVector.addElement(new Option(
       "",
       "", 0, "\nOptions specific to classifier "
       + m_Template.getClass().getName() + ":"));
      Enumeration enu = ((OptionHandler)m_Template).listOptions();
      while (enu.hasMoreElements()) {
  newVector.addElement(enu.nextElement());
      }
    }
    return newVector.elements();
  }
View Full Code Here

   * Returns an enumeration of any additional measure names that might be
   * in the classifier
   * @return an enumeration of the measure names
   */
  public Enumeration enumerateMeasures() {
    Vector newVector = new Vector();
    if (m_Template instanceof AdditionalMeasureProducer) {
      Enumeration en = ((AdditionalMeasureProducer)m_Template).
  enumerateMeasures();
      while (en.hasMoreElements()) {
  String mname = (String)en.nextElement();
  newVector.addElement(mname);
      }
    }
    return newVector.elements();
  }
View Full Code Here

    public Neighbour selectNeighbour(Solution solution) {
        Model model = solution.getModel();
        if (iVarEn==null) {
            iVarEn = new RandomEnumeration(model.variables(), iRandomOrder);
            iVariable = (Variable)iVarEn.nextElement();
            Vector v2 = new Vector(iVariable.values().size()+model.variables().size());
            if (iAllowSwaps && iVariable instanceof Swapable)
                v2.addAll(model.variables());
            v2.addAll(iVariable.values());
            iValEn = new RandomEnumeration(v2, iRandomOrder);
        }
        SimpleNeighbour n = null;
        if (!iValEn.hasMoreElements()) {
            if (!iVarEn.hasMoreElements()) {
                iVarEn = new RandomEnumeration(model.variables(), iRandomOrder);
            }
            iVariable = (Variable)iVarEn.nextElement();
            Vector v2 = new Vector(iVariable.values().size()+model.variables().size());
            if (iAllowSwaps && iVariable instanceof Swapable)
                v2.addAll(model.variables());
            v2.addAll(iVariable.values());
            iValEn = new RandomEnumeration(v2, iRandomOrder);
        }
        Object object = iValEn.nextElement();
        if (object instanceof Variable) {
            Variable anotherVariable = (Variable)ToolBox.random(model.variables());
View Full Code Here

         **/
        public RandomEnumeration(Vector collection, boolean randomOrder) {
            if (!randomOrder) {
                iEnum = collection.elements();
            } else {
                Vector vect = new Vector(collection);
                Collections.shuffle(vect, ToolBox.getRandom());
                iEnum = vect.elements();
            }
        }
View Full Code Here

TOP

Related Classes of java.util.Vector

Copyright © 2015 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.